python为6.5版本,安装在c:\python26 目录下。
django为1.31版本,安装在c:\django-1.31目录下。
在系统环境变量在path里增加如下两条,注意用分号隔开:
C:\Python26\;
C:\Python26\Lib\site-packages\django\bin
理论上来说就可以了,但实际上还是有问题,报错如下:
C:\Users\smile>python django-admin.py startproject mon
python: can't open file 'django-admin.py': [Errno 2] No such file or directory
只好采用一种变通的方式解决,新建一个start_django的bat文件,里面增加如下两行:
- @set django=python c:\python26\scripts\django-admin.py
- @cmd
每次需要的时候直接使用start_django.bat即可。
C:\Django-1.3>%dj% startproject mon
C:\Django-1.3>%django%
Usage: django-admin.py subcommand [options] [args]
Options:
-v VERBOSITY, --verbosity=VERBOSITY
Verbosity level; 0=minimal output, 1=normal output,
2=all output
--settings=SETTINGS The Python path to a settings module, e.g.
"myproject.settings.main". If this isn't provided, the
DJANGO_SETTINGS_MODULE environment variable will be
used.
--pythonpath=PYTHONPATH
A directory to add to the Python path, e.g.
"/home/djangoprojects/myproject".
--traceback Print traceback on exception
--version show program's version number and exit
-h, --help show this help message and exit
Type 'django-admin.py help <subcommand>' for help on a specific subcommand.
Available subcommands:
cleanup
compilemessages
createcachetable
dbshell
diffsettings
dumpdata
flush
inspectdb
loaddata
makemessages
reset
runfcgi
runserver
shell
sql
sqlall
sqlclear
sqlcustom
sqlflush
sqlindexes
sqlinitialdata
sqlreset
sqlsequencereset
startapp
startproject
syncdb
test
testserver
validate