django-admin.py

Section: (1)
Updated: March 2008
Index Return to Main Contents
 

NAME

django-admin.py - Utility script for the Django web framework  

SYNOPSIS

django-admin.py <action> [options]

 

DESCRIPTION

This utility script provides commands for creation and maintenance of Django projects and apps.

With the exception of startproject, all commands listed below can also be performed with the manage.py script found at the top level of each Django project directory.

 

ACTIONS

cleanup
Cleans out old data from the database (only expired sessions at the moment).
compilemessages [--locale=LOCALE]
Compiles .po files to .mo files for use with builtin gettext support.
createcachetable [tablename]
Creates the table needed to use the SQL cache backend
dbshell
Runs the command-line client for the specified databaseENGINE.
diffsettings
Displays differences between the current settings.py and Django's default settings. Settings that don't appear in the defaults are followed by "###".
inspectdb
Introspects the database tables in the database specified in settings.py and outputs a Django model module.
install [appname ...]
Executes sqlall for the given app(s) in the current database.
makemessages [--locale=LOCALE] [--domain=DOMAIN] [--extension=EXTENSION] [--all] [--symlinks] [--ignore=PATTERN] [--no-default-ignore]
Runs over the entire source tree of the current directory and pulls out all strings marked for translation. It creates (or updates) a message file in the conf/locale (in the django tree) or locale (for project and application) directory.
reset [appname ...]
Executes sqlreset for the given app(s) in the current database.
runfcgi [KEY=val] [KEY=val] ...
Runs this project as a FastCGI application. Requires flup. Use runfcgi help for help on the KEY=val pairs.
runserver [--noreload] [--adminmedia=ADMIN_MEDIA_PATH] [port|ipaddr:port]
Starts a lightweight Web server for development.
shell [--plain]
Runs a Python interactive interpreter. Tries to use IPython, if it's available. The --plain option forces the use of the standard Python interpreter even when IPython is installed.
sql [appname ...]
Prints the CREATE TABLE SQL statements for the given app name(s).
sqlall [appname ...]
Prints the CREATE TABLE, initial-data and CREATE INDEX SQL statements for the given model module name(s).
sqlclear [appname ...]
Prints the DROP TABLE SQL statements for the given app name(s).
sqlindexes [appname ...]
Prints the CREATE INDEX SQL statements for the given model module name(s).
sqlinitialdata [appname ...]
Prints the initial INSERT SQL statements for the given app name(s).
sqlreset [appname ...]
Prints the DROP TABLE SQL, then the CREATE TABLE SQL, for the given app name(s).
sqlsequencereset [appname ...]
Prints the SQL statements for resetting PostgreSQL sequences for the given app name(s).
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.
syncdb
Creates the database tables for all apps in INSTALLED_APPS whose tables haven't already been created.
test [--verbosity] [appname ...]
Runs the test suite for the specified applications, or the entire project if no apps are specified
validate
Validates all installed models.
 

OPTIONS

--version
Show program's version number and exit.
-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".
--plain
Use plain Python, not IPython, for the "shell" command.
--noinput
Do not prompt the user for input.
--noreload
Disable the development server's auto-reloader.
--verbosity=VERBOSITY
Verbosity level: 0=minimal output, 1=normal output, 2=all output.
--adminmedia=ADMIN_MEDIA_PATH
Specifies the directory from which to serve admin media when using the development server.
-l, --locale=LOCALE
The locale to process when using makemessages or compilemessages.
-d, --domain=DOMAIN
The domain of the message files (default: "django") when using makemessages.
-e, --extension=EXTENSION
The file extension(s) to examine (default: ".html", separate multiple extensions with commas, or use -e multiple times).
-e, --symlinks
Follows symlinks to directories when examining source code and templates for translation strings.
-e, --ignore=PATTERN
Ignore files or directories matching this glob-style pattern. Use multiple times to ignore more.
-e, --no-default-ignore
Don't ignore the common private glob-style patterns 'CVS', '.*' and '*~'.
-a, --all
Process all available locales when using makemessages..SH "ENVIRONMENT"
DJANGO_SETTINGS_MODULE
In the absence of the --settings option, this environment variable defines the settings module to be read. It should be in Python-import form, e.g. "myproject.settings".

 

SEE ALSO

Full descriptions of all these options, with examples, as well as documentation for the rest of the Django framework, can be found on the Django site:

http://docs.djangoproject.com/en/dev/

or in the distributed documentation.  

AUTHORS/CREDITS

Originally developed at World Online in Lawrence, Kansas, USA. Refer to the AUTHORS file in the Django distribution for contributors.

 

LICENSE

New BSD license. For the full license text refer to the LICENSE file in the Django distribution.