Django 项目是一个定制框架,它源自一个在线新闻 Web 站点,于 2005 年以开源的形式被释放出来。Django 框架的核心组件有:用于创建模型的对象关系映射,为最终用户设计的完美管理界面,一流的 URL
设计,设计者友好的模板语言,缓存系统等。
为了搭建Django开发环境,先去Django官网看看。在Dlownload目录下告诉了用户怎么获取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。
通过上面的pip链接,进入pip的installion介绍文档,内容如下。
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框架已经装好了。