首页 > 代码库 > Django开发环境搭建
Django开发环境搭建
How to get Django
Django is available open-source under the BSD license. It requires Python version 2.7 or higher, but it has no dependencies on other Python libraries. There are several ways you can get it:
Option 1. Get the latest official version
The latest official version is 1.7.1.
You can install it with pip:
pip install Django==1.7.1
Option 2. Get the latest development version
The latest and greatest Django version is the one that‘s in our Git repository (our revision-control system). Get it using this shell command, which requires Git:
git clone https://github.com/django/django.git
You can also download a zipped archive of the development version.
下面先采用第一种方法,得先安装pip。pip还是挺好用的,不仅仅是装Django。
Installation
Python & OS Support
pip works with CPython versions 2.6, 2.7, 3.1, 3.2, 3.3, 3.4 and also pypy.
pip works on Unix/Linux, OS X, and Windows.
Note
Python 2.5 was supported through v1.3.1, and Python 2.4 was supported through v1.1.
Install pip
To install or upgrade pip, securely download get-pip.py. [1]
Then run the following (which may require administrator access):
python get-pip.py
If setuptools (or distribute) is not already installed, get-pip.py will install setuptools for you.
先下载get-pip.py,然后运行,pip就装好了。
bowen:Downloads bowen$ sudo python get-pip.py Password: Downloading/unpacking pip Downloading pip-1.5.6-py2.py3-none-any.whl (1.0MB): 1.0MB downloaded Installing collected packages: pip Successfully installed pip Cleaning up…
然后通过pip安装Django。
bowen:Downloads bowen$ sudo pip install Django==1.7.1 Password: Downloading/unpacking Django==1.7.1 Downloading Django-1.7.1-py2.py3-none-any.whl (7.4MB): 7.4MB downloaded Installing collected packages: Django Successfully installed Django Cleaning up…
在Python命令行下输入
>>> import django >>> print django.VERSION (1, 7, 1, 'final', 0) >>>
正确显示了安装的Django版本,表示Django框架已经装好了。
Django开发环境搭建