本文主要是介绍django项目中的manage.py,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
项目根目录下的manage.py文件,是对django-admin.py的简单封装。
查看manage.py中的命令:python manage.py help
(sg_env) C:\D\Python\Python310\study\snap_gram>python manage.py helpType 'manage.py help <subcommand>' for help on a specific subcommand.Available subcommands:[auth]changepasswordcreatesuperuser[contenttypes]remove_stale_contenttypes[django]checkcompilemessagescreatecachetabledbshelldiffsettingsdumpdataflushinspectdbloaddatamakemessagesmakemigrationsmigrateoptimizemigrationsendtestemailshellshowmigrationssqlflushsqlmigratesqlsequenceresetsquashmigrationsstartappstartprojecttesttestserver[sessions]clearsessions[staticfiles]collectstaticfindstaticrunserver
查看具体命令信息,以startapp为例:python manage.py help startapp
(sg_env) C:\D\Python\Python310\study\snap_gram>python manage.py help startapp
usage: manage.py startapp [-h] [--template TEMPLATE] [--extension EXTENSIONS] [--name FILES] [--exclude [EXCLUDE]][--version] [-v {0,1,2,3}] [--settings SETTINGS] [--pythonpath PYTHONPATH] [--traceback][--no-color] [--force-color]name [directory]Creates a Django app directory structure for the given app name in the current directory or optionally in the given
directory.positional arguments:name Name of the application or project.directory Optional destination directoryoptions:-h, --help show this help message and exit--template TEMPLATE The path or URL to load the template from.--extension EXTENSIONS, -e EXTENSIONSThe file extension(s) to render (default: "py"). Separate multiple extensions with commas, oruse -e multiple times.--name FILES, -n FILESThe file name(s) to render. Separate multiple file names with commas, or use -n multipletimes.--exclude [EXCLUDE], -x [EXCLUDE]The directory name(s) to exclude, in addition to .git and __pycache__. Can be used multipletimes.--version Show program's version number and exit.-v {0,1,2,3}, --verbosity {0,1,2,3}Verbosity level; 0=minimal output, 1=normal output, 2=verbose output, 3=very verbose 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 PYTHONPATHA directory to add to the Python path, e.g. "/home/djangoprojects/myproject".--traceback Raise on CommandError exceptions.--no-color Don't colorize the command output.--force-color Force colorization of the command output.
这篇关于django项目中的manage.py的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!