python+django web开发环境搭建

下载
python-2.7.2.msi  http://www.python.org/getit/
Django-1.3.1.tar.gz    https://www.djangoproject.com/

Django暂时只支持python 2.4 ~ 2.7, 在Django-1.3.1\docs\intro\install.txt中有说明: 
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;

安装python-2.7.2,并添加环境变量
D:\Python27;D:\Python27\Scripts;

命令行进入Django-1.3.1目录, 安装django
python setup.py install

Django提供了tutorial
Django-1.3.1\docs\intro

新建站点
E:\python>django-admin.py startproject mysite

启动django自带的web服务器
E:\python>cd mysite
E:\python\mysite>manage.py runserver
Validating models...

0 errors found
Django version 1.3.1, using settings 'mysite.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.

在浏览器中输入  http://127.0.0.1:8000/ 浏览页面

ps:
在windows7中按上述步骤配置好后,出现下列情况

D:\work\python>django-admin.py startproject mysite
Usage: django-admin.py subcommand [options] [args]
...

很显然django-admin.py不参识别startproject命令,其它命令也不能识别。 不过,另一种方式却可以
D:\Python27\Scripts>python django-admin.py startproject mysite

这说明django-admin.py 后面的参数不能传递进去,可以通过修改注册表实现。
输入regedit, 进入 HKEY_CLASSES_ROOT\py_auto_file\shell\open\command , "C:\Python26\python.exe" "%1" change it to "C:\Python26\python.exe" "%1" %*
成功解决了


你可能感兴趣的:(django,web开发,server,python,command,web服务)