django-admin.1 8.18 KB
Newer Older
1
.TH "django-admin.py" "1" "March 2008" "Django Project" ""
2
.SH "NAME"
3
django\-admin.py \- Utility script for the Django Web framework
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
.SH "SYNOPSIS"
.B django\-admin.py
.I <action>
.B [options]
.sp
.SH "DESCRIPTION"
This utility script provides commands for creation and maintenance of Django
projects and apps.
.sp
With the exception of
.BI startproject,
all commands listed below can also be performed with the
.BI manage.py
script found at the top level of each Django project directory.
.sp
.SH "ACTIONS"
.TP
21 22 23 24 25 26
.BI cleanup
Cleans out old data from the database (only expired sessions at the moment).
.TP
.BI "compilemessages [" "\-\-locale=LOCALE" "]"
Compiles .po files to .mo files for use with builtin gettext support.
.TP
27 28 29
.BI "createcachetable [" "tablename" "]"
Creates the table needed to use the SQL cache backend
.TP
30 31 32
.BI "createsuperuser [" "\-\-username=USERNAME" "] [" "\-\-email=EMAIL" "]"
Creates a superuser account (a user who has all permissions).
.TP
33
.B dbshell
34 35
Runs the command\-line client for the specified
.BI database ENGINE.
36 37 38 39 40 41 42
.TP
.B diffsettings
Displays differences between the current
.B settings.py
and Django's default settings. Settings that don't appear in the defaults are
followed by "###".
.TP
43 44 45 46 47 48 49 50
.BI "dumpdata [" "\-\-all" "] [" "\-\-format=FMT" "] [" "\-\-indent=NUM" "] [" "\-\-natural=NATURAL" "] [" "appname appname appname.Model ..." "]"
Outputs to standard output all data in the database associated with the named
application(s).
.TP
.BI flush
Returns the database to the state it was in immediately after syncdb was
executed.
.TP
51 52 53 54
.B inspectdb
Introspects the database tables in the database specified in settings.py and outputs a Django
model module.
.TP
55 56 57
.BI "loaddata [" "fixture fixture ..." "]"
Searches for and loads the contents of the named fixture into the database.
.TP
58 59 60 61 62
.BI "install [" "appname ..." "]"
Executes
.B sqlall
for the given app(s) in the current database.
.TP
63
.BI "makemessages [" "\-\-locale=LOCALE" "] [" "\-\-domain=DOMAIN" "] [" "\-\-extension=EXTENSION" "] [" "\-\-all" "] [" "\-\-symlinks" "] [" "\-\-ignore=PATTERN" "] [" "\-\-no\-default\-ignore" "] [" "\-\-no\-wrap" "] [" "\-\-no\-location" "]"
64 65 66 67
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.
.TP
68 69 70 71 72
.BI "runfcgi [" "KEY=val" "] [" "KEY=val" "] " "..."
Runs this project as a FastCGI application. Requires flup. Use
.B runfcgi help
for help on the KEY=val pairs.
.TP
73
.BI "runserver [" "\-\-noreload" "] [" "\-\-nothreading" "] [" "\-\-nostatic" "] [" "\-\-insecure" "] [" "\-\-ipv6" "] [" "port|ipaddr:port" "]"
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
Starts a lightweight Web server for development.
.TP
.BI "shell [" "\-\-plain" "]"
Runs a Python interactive interpreter. Tries to use IPython, if it's available.
The
.BI \-\-plain
option forces the use of the standard Python interpreter even when IPython is
installed.
.TP
.BI "sql [" "appname ..." "]"
Prints the CREATE TABLE SQL statements for the given app name(s).
.TP
.BI "sqlall [" "appname ..." "]"
Prints the CREATE TABLE, initial\-data and CREATE INDEX SQL statements for the
given model module name(s).
.TP
.BI "sqlclear [" "appname ..." "]"
Prints the DROP TABLE SQL statements for the given app name(s).
.TP
93 94 95 96
.BI "sqlcustom [" "appname ..." "]"
Prints the custom SQL statements for the given app name(s).
.TP
.BI "sqlflush [" "appname ..." "]"
97
Prints the SQL statements that would be executed for the "flush" command.
98
.TP
99 100 101 102 103 104 105 106 107 108
.BI "sqlindexes [" "appname ..." "]"
Prints the CREATE INDEX SQL statements for the given model module name(s).
.TP
.BI "sqlinitialdata [" "appname ..." "]"
Prints the initial INSERT SQL statements for the given app name(s).
.TP
.BI "sqlsequencereset [" "appname ..." "]"
Prints the SQL statements for resetting PostgreSQL sequences for the
given app name(s).
.TP
109
.BI "startapp [" "\-\-template=PATH_OR_URL" "] [" "\-\-extension=EXTENSION" "] [" "\-\-name=FILENAME" "] [" "appname" "] [" "destination" "]"
110
Creates a Django app directory structure for the given app name in
111
the current directory or the optional destination.
112
.TP
113
.BI "startproject [" "\-\-template=PATH_OR_URL" "] [" "\-\-extension=EXTENSION" "] [" "\-\-name=FILENAME" "] [" "projectname" "] [" "destination" "]"
114
Creates a Django project directory structure for the given project name
115
in the current directory or the optional destination.
116 117 118 119 120
.TP
.BI syncdb
Creates the database tables for all apps in INSTALLED_APPS whose tables
haven't already been created.
.TP
121 122 123 124 125
.BI "test [" "\-\-verbosity" "] [" "\-\-failfast" "] [" "appname ..." "]"
Runs the test suite for the specified applications, or the entire project if
no apps are specified
.TP
.BI "testserver [" "\-\-addrport=ipaddr|port" "] [" "fixture fixture ..." "]"
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
Runs the test suite for the specified applications, or the entire project if
no apps are specified
.TP
.BI validate
Validates all installed models.
.SH "OPTIONS"
.TP
.I \-\-version
Show program's version number and exit.
.TP
.I \-h, \-\-help
Show this help message and exit.
.TP
.I \-\-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.
.TP
.I \-\-pythonpath=PYTHONPATH
Lets you manually add a directory the Python path,
e.g. "/home/djangoprojects/myproject".
.TP
.I \-\-plain
Use plain Python, not IPython, for the "shell" command.
.TP
.I \-\-noinput
Do not prompt the user for input.
.TP
.I \-\-noreload
Disable the development server's auto\-reloader.
.TP
157
.I \-\-nostatic
158
Disable automatic serving of static files from STATIC_URL.
159
.TP
160 161 162
.I \-\-nothreading
Disable the development server's threading.
.TP
163 164 165
.I \-\-insecure
Enables serving of static files even if DEBUG is False.
.TP
166 167 168
.I \-\-ipv6
Enables IPv6 addresses.
.TP
169 170 171
.I \-\-verbosity=VERBOSITY
Verbosity level: 0=minimal output, 1=normal output, 2=all output.
.TP
172 173 174 175 176
.I \-\-traceback
By default, django-admin.py will show a simple error message whenever an
error occurs. If you specify this option, django-admin.py  will
output a full stack trace whenever an exception is raised.
.TP
177 178 179 180 181 182
.I \-l, \-\-locale=LOCALE
The locale to process when using makemessages or compilemessages.
.TP
.I \-d, \-\-domain=DOMAIN
The domain of the message files (default: "django") when using makemessages.
.TP
183
.I \-e, \-\-extension=EXTENSION
184
The file extension(s) to examine (separate multiple
185
extensions with commas, or use \-e multiple times) (makemessages command).
186
.TP
187
.I \-s, \-\-symlinks
188
Follows symlinks to directories when examining source code and templates for
189
translation strings (makemessages command).
190
.TP
191
.I \-i, \-\-ignore=PATTERN
192
Ignore files or directories matching this glob-style pattern. Use multiple
193
times to ignore more (makemessages command).
194
.TP
195
.I \-\-no\-default\-ignore
196
Don't ignore the common private glob-style patterns 'CVS', '.*' and '*~' (makemessages command).
197
.TP
198
.I \-\-no\-wrap
199 200 201 202
Don't break long message lines into several lines (makemessages command).
.TP
.I \-\-no\-location
Don't write '#: filename:line' comment lines in language files (makemessages command).
203
.TP
204
.I \-a, \-\-all
205
Process all available locales when using makemessages.
206
.TP
207
.I \-\-template=PATH_OR_URL
208 209
The file or directory path or URL to load the project and app templates from.
.TP
210 211 212
.I \-n, \-\-name=FILENAME
The name of an additional file to render when using app and project templates.
.TP
213 214 215 216 217
.I \-\-database=DB
Used to specify the database on which a command will operate. If not
specified, this option will default to an alias of "default".
.SH "ENVIRONMENT"
.TP
218 219 220 221 222 223 224 225 226 227
.I DJANGO_SETTINGS_MODULE
In the absence of the
.BI \-\-settings
option, this environment variable defines the settings module to be read.
It should be in Python-import form, e.g. "myproject.settings".

.SH "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:
.sp
228
.I http://docs.djangoproject.com/en/dev/
229 230 231 232 233 234 235 236 237 238
.sp
or in the distributed documentation.
.SH "AUTHORS/CREDITS"
Originally developed at World Online in Lawrence, Kansas, USA. Refer to the
AUTHORS file in the Django distribution for contributors.
.sp
.SH "LICENSE"
New BSD license. For the full license text refer to the LICENSE file in the
Django distribution.