Django首次安装 [英] Django installation first time

查看:107
本文介绍了Django首次安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我第一次开始学习DJango。我有一些python的基本知识,但DJango是我的第一个。我开始使用 django 的文档页面,但是我已经陷入困境要求


python manage.py syncdb


目前我没有任何数据库,所以我假设SQLite带有django。不知道怎么走?另外我已经下载了virtualenv-1.7.1.2并安装了它,


python virtualenv.py ENV


我正在关注此视频教程,它要求我使用


sudo pip install virtualenv




但是当我写上面的代码时,输​​出是


sudo:pip:命令未找到


帮助我!

解决方案

不要使用带有virtualenv的sudo 这是以后最简单的多个问题。



首先安装 virtualenv - sudo apt-get install python-virtualenv



运行以下命令:


  1. $ virtu alenv --no-site-packages django-env

  2. $ source django-env / bin / activate

  3. (django-env)$ pip install django

  4. (django-env)$ django-admin.py startproject myproject

  5. (django-env)$ cd myproject

  6. (django-env)/ myproject $ nano settings.py

  7. settings.py 之后,'ENGINE:'键入'django.db.backends。 sqlite3',(不要忘记逗号)

  8. settings.py 之后, code>'NAME:'键入'site.db',(再次,不要忘记逗号)

  9. 保存文件并退出编辑器

  10. (django-env)/ myproject $ python manage.py syncdb


I started learning DJango for the first time. I have some amount of basic knowledge of python but DJango is first for me. I started with the documentation page of django, but i am getting stuck where it asks for

python manage.py syncdb

At present i do not have any database, so i assumed that SQLite comes with django. Not sure how to go ahead? Also i have downloaded the virtualenv-1.7.1.2 and installed it as well with,

python virtualenv.py ENV

I am following this video tutorial, it asks me to use,

sudo pip install virtualenv

But when i write the above code, the output is,

sudo: pip: command not found

Help me out!!

解决方案

Do not use sudo with virtualenv this is the easiest way to multiple problems later.

Begin by installing virtualenv - sudo apt-get install python-virtualenv

Next, as your normal user run the following commands:

  1. $ virtualenv --no-site-packages django-env
  2. $ source django-env/bin/activate
  3. (django-env)$ pip install django
  4. (django-env)$ django-admin.py startproject myproject
  5. (django-env)$ cd myproject
  6. (django-env)/myproject$ nano settings.py
  7. In settings.py, after 'ENGINE:' type 'django.db.backends.sqlite3', (don't forget the comma)
  8. In settings.py, after the 'NAME:' type 'site.db', (again, don't forget the comma)
  9. Save the file, and exit the editor
  10. (django-env)/myproject$ python manage.py syncdb

这篇关于Django首次安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆