首页 > 代码库 > Install Django

Install Django

https://docs.djangoproject.com/en/1.10/intro/tutorial01/
http://www.aichengxu.com/view/42213

 

1.first install python


2.install Django

pip install Django==1.10.4
======
python
>>> import django
>>> print(django.get_version())
1.10.4
=====or======
python -m django --version
1.10.4
======

 

3.create a project
$ django-admin startproject mysite

//此时出现一些问题,说明还是没有安装好django,解决方法是:
建立虚拟环境,在虚拟环境下安装django,

at this point,there are some problems that django is not installed successfully,slove as follows:
1.install virtual environment
2.install django in a virtual environment

 


4.install virtualenv(creat a virtual env)
$ pip install virtualenv
$ virtualenv --version
$ virtualenv venv
$ source venv/bin/activate
$ deactivate //jump out of the virtual env

5.此时执行
pip install django
django-admin.py --help //mean the installation is successful
现在可以敲写这行命令来建一个project了:
now you can type the command line for creating a project
$ django-admin startproject mysite

Install Django