Django首次安装 [英] Django installation first time
问题描述
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
运行以下命令:
-
$ virtu alenv --no-site-packages django-env
-
$ source django-env / bin / activate
-
(django-env)$ pip install django
-
(django-env)$ django-admin.py startproject myproject
-
(django-env)$ cd myproject
-
(django-env)/ myproject $ nano settings.py
- 在
settings.py
之后,'ENGINE:'
键入'django.db.backends。 sqlite3',
(不要忘记逗号) - 在
settings.py
之后, code>'NAME:'键入'site.db',
(再次,不要忘记逗号) - 保存文件并退出编辑器
-
(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:
$ virtualenv --no-site-packages django-env
$ source django-env/bin/activate
(django-env)$ pip install django
(django-env)$ django-admin.py startproject myproject
(django-env)$ cd myproject
(django-env)/myproject$ nano settings.py
- In
settings.py
, after'ENGINE:'
type'django.db.backends.sqlite3',
(don't forget the comma) - In
settings.py
, after the'NAME:'
type'site.db',
(again, don't forget the comma) - Save the file, and exit the editor
(django-env)/myproject$ python manage.py syncdb
这篇关于Django首次安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!