突然想起一个问题,在工程里面执行python manage.py 到底执行了什么?
安装好django之后,会发现有个django-admin.py在你的path目录中。
通过这个命令就可以执行很多动作,下面举例一些比较重要的。
1. syncdb
通过model同步数据库表
安装好django之后,会发现有个django-admin.py在你的path目录中。
yunpeng@yunpeng-duitang:~/workspace/atlas$ django-admin.py
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
通过这个命令就可以执行很多动作,下面举例一些比较重要的。
1. syncdb
通过model同步数据库表
yunpeng@yunpeng-duitang:~/workspace/atlas$ python manage.py syncdb
Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table auth_message
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table member_member
Creating table video_album
Creating table video_video