存档

2010年9月21日 的存档

Django安装

2010年9月21日 没有评论

Django介绍就免去了,昨天下载后,想安装,安装网上搜索的结果,就报错失败。今天看了官方文档,才搞定。看来一切都得以官方文档为准。

1.Python版本
Install Python
Being a Python Web framework, Django requires Python.

It works with any Python version from 2.4 to 2.7 (due to backwards incompatibilities in Python 3.0, Django does not currently work with Python 3.0; see the Django FAQ for more information on supported Python versions and the 3.0 transition).

说的很清楚,支持的Python版本从2.4到2.7,现在还不兼容3.0以上版本。

2.数据库
If you plan to use Django’s database API functionality, you’ll need to make sure a database server is running. Django supports many different database servers and is officially supported with PostgreSQL, MySQL, Oracle and SQLite (although SQLite doesn’t require a separate server to be running).

可以不用数据库,是可选的。这里只列出官方支持的版本,还有一些第三方支持的版本。

3.安装Django
Installing an official release
1)Download the latest release from our download page.
2)Untar the downloaded file (e.g. tar xzvf Django-NNN.tar.gz, where NNN is the version number of the latest release). If you’re using Windows, you can 3)download the command-line tool bsdtar to do this, or you can use a GUI-based tool such as 7-zip.
3)Change into the directory created in step 2 (e.g. cd Django-NNN).
4)If you’re using Linux, Mac OS X or some other flavor of Unix, enter the command sudo python setup.py install at the shell prompt. If you’re using Windows, start up a command shell with administrator privileges and run the command setup.py install.

These commands will install Django in your Python installation’s site-packages directory.

下载官方版本,默认格式都是tar.gz。
windows下用7z或者winrar解压。
进入解压缩后的文件目录。
类Unix的使用sudo python setup.py install命令安装(在终端里)。windows的使用setup.py install命令安装(在命令行里)。

注意的问题,是Python的路径要配置正确,大部分网上给出的,都是python setup.py install,都不行。关键还是要看官方文档。

分类: 编程技术 标签: