使用 Django 和 Python 开发 Web 站点
2007-03-29 12:41:22 来源:WEB开发网清单 2. 使用 Django 管理工具~/dev$ django-admin.py
usage: django-admin.py action [options]
actions:
adminindex [modelmodule ...]
Prints the admin-index template snippet for the given model
module name(s).
... snip ...
startapp [appname]
Creates a Django app directory structure for the given app name
in the current directory.
startproject [projectname]
Creates a Django project directory structure for the given
project name in the current directory.
validate
Validates all installed models.
options:
-h, --help show this help message and exit
--settings=SETTINGS Python path to settings module, e.g.
"myproject.settings.main". If this isn't
provided, the DJANGO_SETTINGS_MODULE
environment variable will be used.
--pythonpath=PYTHONPATH
Lets you manually add a directory the Python
path, e.g. "/home/djangoprojects/myproject".
Django 项目和应用程序
要启动 Django 项,请使用 django-admin startproject 命令,如下所示:
清单 3. 启动项目~/dev$ django-admin.py startproject djproject
上面这个命令会创建一个 djproject 目录,其中包含了运行 Django 项目所需要的基本配置文件:
清单 4. djproject 目录的内容
更多精彩
赞助商链接