1
0
mirror of https://github.com/django/django.git synced 2025-04-01 12:06:43 +00:00

Updated man page for Django 2.1 alpha.

This commit is contained in:
Tim Graham 2018-05-17 09:30:20 -04:00
parent 77f6340d3b
commit 253fcff90f

View File

@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText. .\" Man page generated from reStructuredText.
. .
.TH "DJANGO-ADMIN" "1" "September 22, 2017" "2.0" "Django" .TH "DJANGO-ADMIN" "1" "May 17, 2018" "2.1" "Django"
.SH NAME .SH NAME
django-admin \- Utility script for the Django Web framework django-admin \- Utility script for the Django Web framework
. .
@ -31,7 +31,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
.. ..
.sp .sp
\fBdjango\-admin\fP is Djangos command\-line utility for administrative tasks. \fBdjango\-admin\fP is Django\(aqs command\-line utility for administrative tasks.
This document outlines all it can do. This document outlines all it can do.
.sp .sp
In addition, \fBmanage.py\fP is automatically created in each Django project. In addition, \fBmanage.py\fP is automatically created in each Django project.
@ -39,14 +39,14 @@ In addition, \fBmanage.py\fP is automatically created in each Django project.
things for you: things for you:
.INDENT 0.0 .INDENT 0.0
.IP \(bu 2 .IP \(bu 2
It puts your projects package on \fBsys.path\fP\&. It puts your project\(aqs package on \fBsys.path\fP\&.
.IP \(bu 2 .IP \(bu 2
It sets the \fBDJANGO_SETTINGS_MODULE\fP environment variable so that It sets the \fBDJANGO_SETTINGS_MODULE\fP environment variable so that
it points to your projects \fBsettings.py\fP file. it points to your project\(aqs \fBsettings.py\fP file.
.UNINDENT .UNINDENT
.sp .sp
The \fBdjango\-admin\fP script should be on your system path if you installed The \fBdjango\-admin\fP script should be on your system path if you installed
Django via its \fBsetup.py\fP utility. If its not on your path, you can find it Django via its \fBsetup.py\fP utility. If it\(aqs not on your path, you can find it
in \fBsite\-packages/django/bin\fP within your Python installation. Consider in \fBsite\-packages/django/bin\fP within your Python installation. Consider
symlinking it from some place on your path, such as \fB/usr/local/bin\fP\&. symlinking it from some place on your path, such as \fB/usr/local/bin\fP\&.
.sp .sp
@ -55,7 +55,7 @@ copy \fBdjango\-admin.exe\fP to a location on your existing path or edit the
\fBPATH\fP settings (under \fBSettings \- Control Panel \- System \- Advanced \- \fBPATH\fP settings (under \fBSettings \- Control Panel \- System \- Advanced \-
Environment...\fP) to point to its installed location. Environment...\fP) to point to its installed location.
.sp .sp
Generally, when working on a single Django project, its easier to use Generally, when working on a single Django project, it\(aqs easier to use
\fBmanage.py\fP than \fBdjango\-admin\fP\&. If you need to switch between multiple \fBmanage.py\fP than \fBdjango\-admin\fP\&. If you need to switch between multiple
Django settings files, use \fBdjango\-admin\fP with Django settings files, use \fBdjango\-admin\fP with
\fBDJANGO_SETTINGS_MODULE\fP or the \fI\%\-\-settings\fP command line \fBDJANGO_SETTINGS_MODULE\fP or the \fI\%\-\-settings\fP command line
@ -97,7 +97,7 @@ Run \fBdjango\-admin help <command>\fP to display a description of the given
command and a list of its available options. command and a list of its available options.
.SS App names .SS App names
.sp .sp
Many commands take a list of “app names.” An “app name” is the basename of Many commands take a list of "app names." An "app name" is the basename of
the package containing your models. For example, if your \fBINSTALLED_APPS\fP the package containing your models. For example, if your \fBINSTALLED_APPS\fP
contains the string \fB\(aqmysite.blog\(aq\fP, the app name is \fBblog\fP\&. contains the string \fB\(aqmysite.blog\(aq\fP, the app name is \fBblog\fP\&.
.SS Determining the version .SS Determining the version
@ -298,7 +298,7 @@ For Oracle, this runs the \fBsqlplus\fP command\-line client.
.sp .sp
This command assumes the programs are on your \fBPATH\fP so that a simple call to This command assumes the programs are on your \fBPATH\fP so that a simple call to
the program name (\fBpsql\fP, \fBmysql\fP, \fBsqlite3\fP, \fBsqlplus\fP) will find the the program name (\fBpsql\fP, \fBmysql\fP, \fBsqlite3\fP, \fBsqlplus\fP) will find the
program in the right place. Theres no way to specify the location of the program in the right place. There\(aqs no way to specify the location of the
program manually. program manually.
.INDENT 0.0 .INDENT 0.0
.TP .TP
@ -312,11 +312,11 @@ Specifies the database onto which to open a shell. Defaults to \fBdefault\fP\&.
.B django\-admin diffsettings .B django\-admin diffsettings
.UNINDENT .UNINDENT
.sp .sp
Displays differences between the current settings file and Djangos default Displays differences between the current settings file and Django\(aqs default
settings (or another settings file specified by \fI\%\-\-default\fP). settings (or another settings file specified by \fI\%\-\-default\fP).
.sp .sp
Settings that dont appear in the defaults are followed by \fB"###"\fP\&. For Settings that don\(aqt appear in the defaults are followed by \fB"###"\fP\&. For
example, the default settings dont define \fBROOT_URLCONF\fP, so example, the default settings don\(aqt define \fBROOT_URLCONF\fP, so
\fBROOT_URLCONF\fP is followed by \fB"###"\fP in the output of \fBROOT_URLCONF\fP is followed by \fB"###"\fP in the output of
\fBdiffsettings\fP\&. \fBdiffsettings\fP\&.
.INDENT 0.0 .INDENT 0.0
@ -324,17 +324,15 @@ example, the default settings dont define \fBROOT_URLCONF\fP, so
.B \-\-all .B \-\-all
.UNINDENT .UNINDENT
.sp .sp
Displays all settings, even if they have Djangos default value. Such settings Displays all settings, even if they have Django\(aqs default value. Such settings
are prefixed by \fB"###"\fP\&. are prefixed by \fB"###"\fP\&.
.INDENT 0.0 .INDENT 0.0
.TP .TP
.B \-\-default MODULE .B \-\-default MODULE
.UNINDENT .UNINDENT
.sp
.sp .sp
The settings module to compare the current settings against. Leave empty to The settings module to compare the current settings against. Leave empty to
compare against Djangos default settings. compare against Django\(aqs default settings.
.INDENT 0.0 .INDENT 0.0
.TP .TP
.B \-\-output {hash,unified} .B \-\-output {hash,unified}
@ -343,7 +341,7 @@ compare against Djangos default settings.
.sp .sp
Specifies the output format. Available values are \fBhash\fP and \fBunified\fP\&. Specifies the output format. Available values are \fBhash\fP and \fBunified\fP\&.
\fBhash\fP is the default mode that displays the output thats described above. \fBhash\fP is the default mode that displays the output that\(aqs described above.
\fBunified\fP displays the output similar to \fBdiff \-u\fP\&. Default settings are \fBunified\fP displays the output similar to \fBdiff \-u\fP\&. Default settings are
prefixed with a minus sign, followed by the changed setting prefixed with a prefixed with a minus sign, followed by the changed setting prefixed with a
plus sign. plus sign.
@ -361,7 +359,7 @@ If no application name is provided, all installed applications will be dumped.
The output of \fBdumpdata\fP can be used as input for \fI\%loaddata\fP\&. The output of \fBdumpdata\fP can be used as input for \fI\%loaddata\fP\&.
.sp .sp
Note that \fBdumpdata\fP uses the default manager on the model for selecting the Note that \fBdumpdata\fP uses the default manager on the model for selecting the
records to dump. If youre using a custom manager as records to dump. If you\(aqre using a custom manager as
the default manager and it filters some of the available records, not all of the the default manager and it filters some of the available records, not all of the
objects will be dumped. objects will be dumped.
.INDENT 0.0 .INDENT 0.0
@ -369,7 +367,7 @@ objects will be dumped.
.B \-\-all, \-a .B \-\-all, \-a
.UNINDENT .UNINDENT
.sp .sp
Uses Djangos base manager, dumping records which might otherwise be filtered Uses Django\(aqs base manager, dumping records which might otherwise be filtered
or modified by a custom manager. or modified by a custom manager.
.INDENT 0.0 .INDENT 0.0
.TP .TP
@ -420,7 +418,7 @@ Specifies the database from which data will be dumped. Defaults to \fBdefault\fP
.sp .sp
Uses the \fBnatural_key()\fP model method to serialize any foreign key and Uses the \fBnatural_key()\fP model method to serialize any foreign key and
many\-to\-many relationship to objects of the type that defines the method. If many\-to\-many relationship to objects of the type that defines the method. If
youre dumping \fBcontrib.auth\fP \fBPermission\fP objects or you\(aqre dumping \fBcontrib.auth\fP \fBPermission\fP objects or
\fBcontrib.contenttypes\fP \fBContentType\fP objects, you should probably use this \fBcontrib.contenttypes\fP \fBContentType\fP objects, you should probably use this
flag. See the natural keys flag. See the natural keys
documentation for more details on this and the next option. documentation for more details on this and the next option.
@ -480,10 +478,13 @@ Specifies the database to flush. Defaults to \fBdefault\fP\&.
.sp .sp
Introspects the database tables in the database pointed\-to by the Introspects the database tables in the database pointed\-to by the
\fBNAME\fP setting and outputs a Django model module (a \fBmodels.py\fP \fBNAME\fP setting and outputs a Django model module (a \fBmodels.py\fP
file) to standard output. You may choose what tables to inspect by passing file) to standard output.
their names as arguments.
.sp .sp
Use this if you have a legacy database with which youd like to use Django. You may choose what tables or views to inspect by passing their names as
arguments. If no arguments are provided, models are created for views only if
the \fI\%\-\-include\-views\fP option is used.
.sp
Use this if you have a legacy database with which you\(aqd like to use Django.
The script will inspect the database and create a model for each table within The script will inspect the database and create a model for each table within
it. it.
.sp .sp
@ -492,7 +493,7 @@ in the table. Note that \fBinspectdb\fP has a few special cases in its field\-na
output: output:
.INDENT 0.0 .INDENT 0.0
.IP \(bu 2 .IP \(bu 2
If \fBinspectdb\fP cannot map a columns type to a model field type, itll If \fBinspectdb\fP cannot map a column\(aqs type to a model field type, it\(aqll
use \fBTextField\fP and will insert the Python comment use \fBTextField\fP and will insert the Python comment
\fB\(aqThis field type is a guess.\(aq\fP next to the field in the generated \fB\(aqThis field type is a guess.\(aq\fP next to the field in the generated
model. The recognized fields may depend on apps listed in model. The recognized fields may depend on apps listed in
@ -510,8 +511,8 @@ field.
.UNINDENT .UNINDENT
.sp .sp
This feature is meant as a shortcut, not as definitive model generation. After This feature is meant as a shortcut, not as definitive model generation. After
you run it, youll want to look over the generated models yourself to make you run it, you\(aqll want to look over the generated models yourself to make
customizations. In particular, youll need to rearrange models order, so that customizations. In particular, you\(aqll need to rearrange models\(aq order, so that
models that refer to other models are ordered properly. models that refer to other models are ordered properly.
.sp .sp
Primary keys are automatically introspected for PostgreSQL, MySQL and Primary keys are automatically introspected for PostgreSQL, MySQL and
@ -521,15 +522,15 @@ needed.
\fBinspectdb\fP works with PostgreSQL, MySQL and SQLite. Foreign\-key detection \fBinspectdb\fP works with PostgreSQL, MySQL and SQLite. Foreign\-key detection
only works in PostgreSQL and with certain types of MySQL tables. only works in PostgreSQL and with certain types of MySQL tables.
.sp .sp
Django doesnt create database defaults when a Django doesn\(aqt create database defaults when a
\fBdefault\fP is specified on a model field. \fBdefault\fP is specified on a model field.
Similarly, database defaults arent translated to model field defaults or Similarly, database defaults aren\(aqt translated to model field defaults or
detected in any fashion by \fBinspectdb\fP\&. detected in any fashion by \fBinspectdb\fP\&.
.sp .sp
By default, \fBinspectdb\fP creates unmanaged models. That is, \fBmanaged = False\fP By default, \fBinspectdb\fP creates unmanaged models. That is, \fBmanaged = False\fP
in the models \fBMeta\fP class tells Django not to manage each tables creation, in the model\(aqs \fBMeta\fP class tells Django not to manage each table\(aqs creation,
modification, and deletion. If you do want to allow Django to manage the modification, and deletion. If you do want to allow Django to manage the
tables lifecycle, youll need to change the table\(aqs lifecycle, you\(aqll need to change the
\fBmanaged\fP option to \fBTrue\fP (or simply remove \fBmanaged\fP option to \fBTrue\fP (or simply remove
it because \fBTrue\fP is its default value). it because \fBTrue\fP is its default value).
.INDENT 0.0 .INDENT 0.0
@ -538,6 +539,14 @@ it because \fBTrue\fP is its default value).
.UNINDENT .UNINDENT
.sp .sp
Specifies the database to introspect. Defaults to \fBdefault\fP\&. Specifies the database to introspect. Defaults to \fBdefault\fP\&.
.INDENT 0.0
.TP
.B \-\-include\-views
.UNINDENT
.sp
.sp
If this option is provided, models are also created for database views.
.SS \fBloaddata\fP .SS \fBloaddata\fP
.INDENT 0.0 .INDENT 0.0
.TP .TP
@ -578,13 +587,11 @@ Specifies the serialization format (e.g.,
.TP .TP
.B \-\-exclude EXCLUDE, \-e EXCLUDE .B \-\-exclude EXCLUDE, \-e EXCLUDE
.UNINDENT .UNINDENT
.sp
.sp .sp
Excludes loading the fixtures from the given applications and/or models (in the Excludes loading the fixtures from the given applications and/or models (in the
form of \fBapp_label\fP or \fBapp_label.ModelName\fP). Use the option multiple form of \fBapp_label\fP or \fBapp_label.ModelName\fP). Use the option multiple
times to exclude more than one app or model. times to exclude more than one app or model.
.SS Whats a “fixture”? .SS What\(aqs a "fixture"?
.sp .sp
A \fIfixture\fP is a collection of files that contain the serialized contents of A \fIfixture\fP is a collection of files that contain the serialized contents of
the database. Each fixture has a unique name, and the files that comprise the the database. Each fixture has a unique name, and the files that comprise the
@ -660,7 +667,7 @@ any \fBpre_save\fP or
\fBpost_save\fP signals will be called with \fBpost_save\fP signals will be called with
\fBraw=True\fP since the instance only contains attributes that are local to the \fBraw=True\fP since the instance only contains attributes that are local to the
model. You may, for example, want to disable handlers that access model. You may, for example, want to disable handlers that access
related fields that arent present during fixture loading and would otherwise related fields that aren\(aqt present during fixture loading and would otherwise
raise an exception: raise an exception:
.INDENT 0.0 .INDENT 0.0
.INDENT 3.5 .INDENT 3.5
@ -746,18 +753,18 @@ installation will be aborted, and any data installed in the call to
.INDENT 3.5 .INDENT 3.5
.IP "MySQL with MyISAM and fixtures" .IP "MySQL with MyISAM and fixtures"
.sp .sp
The MyISAM storage engine of MySQL doesnt support transactions or The MyISAM storage engine of MySQL doesn\(aqt support transactions or
constraints, so if you use MyISAM, you wont get validation of fixture constraints, so if you use MyISAM, you won\(aqt get validation of fixture
data, or a rollback if multiple transaction files are found. data, or a rollback if multiple transaction files are found.
.UNINDENT .UNINDENT
.UNINDENT .UNINDENT
.SS Database\-specific fixtures .SS Database\-specific fixtures
.sp .sp
If youre in a multi\-database setup, you might have fixture data that If you\(aqre in a multi\-database setup, you might have fixture data that
you want to load onto one database, but not onto another. In this you want to load onto one database, but not onto another. In this
situation, you can add a database identifier into the names of your fixtures. situation, you can add a database identifier into the names of your fixtures.
.sp .sp
For example, if your \fBDATABASES\fP setting has a master database For example, if your \fBDATABASES\fP setting has a \(aqmaster\(aq database
defined, name the fixture \fBmydata.master.json\fP or defined, name the fixture \fBmydata.master.json\fP or
\fBmydata.master.json.gz\fP and the fixture will only be loaded when you \fBmydata.master.json.gz\fP and the fixture will only be loaded when you
specify you want to load data into the \fBmaster\fP database. specify you want to load data into the \fBmaster\fP database.
@ -807,8 +814,8 @@ directory. After making changes to the messages files you need to compile them
with \fI\%compilemessages\fP for use with the builtin gettext support. See with \fI\%compilemessages\fP for use with the builtin gettext support. See
the i18n documentation for details. the i18n documentation for details.
.sp .sp
This command doesnt require configured settings. However, when settings arent This command doesn\(aqt require configured settings. However, when settings aren\(aqt
configured, the command cant ignore the \fBMEDIA_ROOT\fP and configured, the command can\(aqt ignore the \fBMEDIA_ROOT\fP and
\fBSTATIC_ROOT\fP directories or include \fBLOCALE_PATHS\fP\&. It will \fBSTATIC_ROOT\fP directories or include \fBLOCALE_PATHS\fP\&. It will
also write files in UTF\-8 rather than in \fBFILE_CHARSET\fP\&. also write files in UTF\-8 rather than in \fBFILE_CHARSET\fP\&.
.INDENT 0.0 .INDENT 0.0
@ -949,9 +956,9 @@ Disables breaking long message lines into several lines in language files.
.B \-\-no\-location .B \-\-no\-location
.UNINDENT .UNINDENT
.sp .sp
Suppresses writing \fB#: filename:line\fP comment lines in language files. Suppresses writing \(aq\fB#: filename:line\fP comment lines in language files.
Using this option makes it harder for technically skilled translators to Using this option makes it harder for technically skilled translators to
understand each messages context. understand each message\(aqs context.
.INDENT 0.0 .INDENT 0.0
.TP .TP
.B \-\-add\-location [{full,file,never}] .B \-\-add\-location [{full,file,never}]
@ -1002,8 +1009,8 @@ Providing one or more app names as arguments will limit the migrations created
to the app(s) specified and any dependencies needed (the table at the other end to the app(s) specified and any dependencies needed (the table at the other end
of a \fBForeignKey\fP, for example). of a \fBForeignKey\fP, for example).
.sp .sp
To add migrations to an app that doesnt have a \fBmigrations\fP directory, run To add migrations to an app that doesn\(aqt have a \fBmigrations\fP directory, run
\fBmakemigrations\fP with the apps \fBapp_label\fP\&. \fBmakemigrations\fP with the app\(aqs \fBapp_label\fP\&.
.INDENT 0.0 .INDENT 0.0
.TP .TP
.B \-\-noinput, \-\-no\-input .B \-\-noinput, \-\-no\-input
@ -1040,9 +1047,6 @@ Enables fixing of migration conflicts.
.UNINDENT .UNINDENT
.sp .sp
Allows naming the generated migration(s) instead of using a generated name. Allows naming the generated migration(s) instead of using a generated name.
.sp
Makes \fBmakemigrations\fP exit with error code 1 when no migrations are created
(or would have been created, if combined with \fB\-\-dry\-run\fP).
.INDENT 0.0 .INDENT 0.0
.TP .TP
.B \-\-check .B \-\-check
@ -1066,7 +1070,7 @@ The behavior of this command changes depending on the arguments provided:
No arguments: All apps have all of their migrations run. No arguments: All apps have all of their migrations run.
.IP \(bu 2 .IP \(bu 2
\fB<app_label>\fP: The specified app has its migrations run, up to the most \fB<app_label>\fP: The specified app has its migrations run, up to the most
recent migration. This may involve running other apps migrations too, due recent migration. This may involve running other apps\(aq migrations too, due
to dependencies. to dependencies.
.IP \(bu 2 .IP \(bu 2
\fB<app_label> <migrationname>\fP: Brings the database schema to a state where \fB<app_label> <migrationname>\fP: Brings the database schema to a state where
@ -1086,11 +1090,11 @@ Specifies the database to migrate. Defaults to \fBdefault\fP\&.
.B \-\-fake .B \-\-fake
.UNINDENT .UNINDENT
.sp .sp
Tells Django to mark the migrations as having been applied or unapplied, but Marks the migrations up to the target one (following the rules above) as
without actually running the SQL to change your database schema. applied, but without actually running the SQL to change your database schema.
.sp .sp
This is intended for advanced users to manipulate the This is intended for advanced users to manipulate the
current migration state directly if theyre manually applying changes; current migration state directly if they\(aqre manually applying changes;
be warned that using \fB\-\-fake\fP runs the risk of putting the migration state be warned that using \fB\-\-fake\fP runs the risk of putting the migration state
table into a state where manual recovery will be needed to make migrations table into a state where manual recovery will be needed to make migrations
run correctly. run correctly.
@ -1099,7 +1103,7 @@ run correctly.
.B \-\-fake\-initial .B \-\-fake\-initial
.UNINDENT .UNINDENT
.sp .sp
Allows Django to skip an apps initial migration if all database tables with Allows Django to skip an app\(aqs initial migration if all database tables with
the names of all models created by all the names of all models created by all
\fBCreateModel\fP operations in that \fBCreateModel\fP operations in that
migration already exist. This option is intended for use when first running migration already exist. This option is intended for use when first running
@ -1112,7 +1116,7 @@ schema matches what is recorded in your initial migration.
.B \-\-run\-syncdb .B \-\-run\-syncdb
.UNINDENT .UNINDENT
.sp .sp
Allows creating tables for apps without migrations. While this isnt Allows creating tables for apps without migrations. While this isn\(aqt
recommended, the migrations framework is sometimes too slow on large projects recommended, the migrations framework is sometimes too slow on large projects
with hundreds of models. with hundreds of models.
.INDENT 0.0 .INDENT 0.0
@ -1140,14 +1144,14 @@ This server uses the WSGI application object specified by the
\fBWSGI_APPLICATION\fP setting. \fBWSGI_APPLICATION\fP setting.
.sp .sp
DO NOT USE THIS SERVER IN A PRODUCTION SETTING. It has not gone through DO NOT USE THIS SERVER IN A PRODUCTION SETTING. It has not gone through
security audits or performance tests. (And thats how its gonna stay. Were in security audits or performance tests. (And that\(aqs how it\(aqs gonna stay. We\(aqre in
the business of making Web frameworks, not Web servers, so improving this the business of making Web frameworks, not Web servers, so improving this
server to be able to handle a production environment is outside the scope of server to be able to handle a production environment is outside the scope of
Django.) Django.)
.sp .sp
The development server automatically reloads Python code for each request, as The development server automatically reloads Python code for each request, as
needed. You dont need to restart the server for code changes to take effect. needed. You don\(aqt need to restart the server for code changes to take effect.
However, some actions like adding files dont trigger a restart, so youll However, some actions like adding files don\(aqt trigger a restart, so you\(aqll
have to restart the server in these cases. have to restart the server in these cases.
.sp .sp
If you are using Linux and install \fI\%pyinotify\fP, kernel signals will be used to If you are using Linux and install \fI\%pyinotify\fP, kernel signals will be used to
@ -1161,7 +1165,7 @@ server is running, the system check framework will check your entire Django
project for some common errors (see the \fI\%check\fP command). If any project for some common errors (see the \fI\%check\fP command). If any
errors are found, they will be printed to standard output. errors are found, they will be printed to standard output.
.sp .sp
You can run as many concurrent servers as you want, as long as theyre on You can run as many concurrent servers as you want, as long as they\(aqre on
separate ports. Just execute \fBdjango\-admin runserver\fP more than once. separate ports. Just execute \fBdjango\-admin runserver\fP more than once.
.sp .sp
Note that the default IP address, \fB127.0.0.1\fP, is not accessible from other Note that the default IP address, \fB127.0.0.1\fP, is not accessible from other
@ -1313,7 +1317,7 @@ django\-admin runserver \-6 localhost:8000
.UNINDENT .UNINDENT
.SS Serving static files with the development server .SS Serving static files with the development server
.sp .sp
By default, the development server doesnt serve any static files for your site By default, the development server doesn\(aqt serve any static files for your site
(such as CSS files, images, things under \fBMEDIA_URL\fP and so forth). If (such as CSS files, images, things under \fBMEDIA_URL\fP and so forth). If
you want to configure Django to serve static media, read you want to configure Django to serve static media, read
/howto/static\-files/index\&. /howto/static\-files/index\&.
@ -1391,7 +1395,7 @@ django\-admin shell \-i bpython
.UNINDENT .UNINDENT
.UNINDENT .UNINDENT
.sp .sp
If you have a “rich” shell installed but want to force use of the “plain” If you have a "rich" shell installed but want to force use of the "plain"
Python interpreter, use \fBpython\fP as the interface name, like so: Python interpreter, use \fBpython\fP as the interface name, like so:
.INDENT 0.0 .INDENT 0.0
.INDENT 3.5 .INDENT 3.5
@ -1408,7 +1412,7 @@ django\-admin shell \-i python
.B \-\-nostartup .B \-\-nostartup
.UNINDENT .UNINDENT
.sp .sp
Disables reading the startup script for the “plain” Python interpreter. By Disables reading the startup script for the "plain" Python interpreter. By
default, the script pointed to by the \fI\%PYTHONSTARTUP\fP environment default, the script pointed to by the \fI\%PYTHONSTARTUP\fP environment
variable or the \fB~/.pythonrc.py\fP script is read. variable or the \fB~/.pythonrc.py\fP script is read.
.INDENT 0.0 .INDENT 0.0
@ -1445,9 +1449,6 @@ $ django\-admin shell <<EOF
.sp .sp
On Windows, the REPL is output due to implementation limits of On Windows, the REPL is output due to implementation limits of
\fI\%select.select()\fP on that platform. \fI\%select.select()\fP on that platform.
.sp
In older versions, the REPL is also output on UNIX systems.
.SS \fBshowmigrations\fP .SS \fBshowmigrations\fP
.INDENT 0.0 .INDENT 0.0
.TP .TP
@ -1479,9 +1480,6 @@ of 2 and above, all dependencies of a migration will also be shown.
.sp .sp
\fBapp_label\fPs arguments limit the output, however, dependencies of provided \fBapp_label\fPs arguments limit the output, however, dependencies of provided
apps may also be included. apps may also be included.
.sp
In older versions, \fBshowmigrations \-\-plan\fP ignores app labels.
.INDENT 0.0 .INDENT 0.0
.TP .TP
.B \-\-database DATABASE .B \-\-database DATABASE
@ -1512,7 +1510,7 @@ Prints the SQL for the named migration. This requires an active database
connection, which it will use to resolve constraint names; this means you must connection, which it will use to resolve constraint names; this means you must
generate the SQL against a copy of the database you wish to later apply it on. generate the SQL against a copy of the database you wish to later apply it on.
.sp .sp
Note that \fBsqlmigrate\fP doesnt colorize its output. Note that \fBsqlmigrate\fP doesn\(aqt colorize its output.
.INDENT 0.0 .INDENT 0.0
.TP .TP
.B \-\-backwards .B \-\-backwards
@ -1600,7 +1598,7 @@ name is given, the app directory will be created in the current working
directory. directory.
.sp .sp
If the optional destination is provided, Django will use that existing If the optional destination is provided, Django will use that existing
directory rather than creating a new one. You can use . to denote the current directory rather than creating a new one. You can use \(aq.\(aq to denote the current
working directory. working directory.
.sp .sp
For example: For example:
@ -1640,7 +1638,7 @@ Django will also accept URLs (\fBhttp\fP, \fBhttps\fP, \fBftp\fP) to compressed
archives with the app template files, downloading and extracting them on the archives with the app template files, downloading and extracting them on the
fly. fly.
.sp .sp
For example, taking advantage of GitHubs feature to expose repositories as For example, taking advantage of GitHub\(aqs feature to expose repositories as
zip files, you can use a URL like: zip files, you can use a URL like:
.INDENT 0.0 .INDENT 0.0
.INDENT 3.5 .INDENT 3.5
@ -1672,16 +1670,18 @@ The \fBtemplate context\fP used for all matching
files is: files is:
.INDENT 0.0 .INDENT 0.0
.IP \(bu 2 .IP \(bu 2
Any option passed to the \fBstartapp\fP command (among the commands supported Any option passed to the \fBstartapp\fP command (among the command\(aqs supported
options) options)
.IP \(bu 2 .IP \(bu 2
\fBapp_name\fP the app name as passed to the command \fBapp_name\fP \-\- the app name as passed to the command
.IP \(bu 2 .IP \(bu 2
\fBapp_directory\fP the full path of the newly created app \fBapp_directory\fP \-\- the full path of the newly created app
.IP \(bu 2 .IP \(bu 2
\fBcamel_case_app_name\fP the app name in camel case format \fBcamel_case_app_name\fP \-\- the app name in camel case format
.IP \(bu 2 .IP \(bu 2
\fBdocs_version\fP the version of the documentation: \fB\(aqdev\(aq\fP or \fB\(aq1.x\(aq\fP \fBdocs_version\fP \-\- the version of the documentation: \fB\(aqdev\(aq\fP or \fB\(aq1.x\(aq\fP
.IP \(bu 2
\fBdjango_version\fP \-\- the version of Django, e.g.\(ga\(ga\(aq2.0.3\(aq\(ga\(ga
.UNINDENT .UNINDENT
.sp .sp
\fBWARNING:\fP \fBWARNING:\fP
@ -1694,7 +1694,7 @@ contains a docstring explaining a particular feature related
to template rendering, it might result in an incorrect example. to template rendering, it might result in an incorrect example.
.sp .sp
To work around this problem, you can use the \fBtemplatetag\fP To work around this problem, you can use the \fBtemplatetag\fP
templatetag to “escape” the various parts of the template syntax. template tag to "escape" the various parts of the template syntax.
.sp .sp
In addition, to allow Python template files that contain Django template In addition, to allow Python template files that contain Django template
language syntax while also preventing packaging systems from trying to language syntax while also preventing packaging systems from trying to
@ -1721,7 +1721,7 @@ will be created in the current working directory.
.sp .sp
If the optional destination is provided, Django will use that existing If the optional destination is provided, Django will use that existing
directory as the project directory, and create \fBmanage.py\fP and the project directory as the project directory, and create \fBmanage.py\fP and the project
package within it. Use . to denote the current working directory. package within it. Use \(aq.\(aq to denote the current working directory.
.sp .sp
For example: For example:
.INDENT 0.0 .INDENT 0.0
@ -1760,16 +1760,18 @@ empty list.
The \fBtemplate context\fP used is: The \fBtemplate context\fP used is:
.INDENT 0.0 .INDENT 0.0
.IP \(bu 2 .IP \(bu 2
Any option passed to the \fBstartproject\fP command (among the commands Any option passed to the \fBstartproject\fP command (among the command\(aqs
supported options) supported options)
.IP \(bu 2 .IP \(bu 2
\fBproject_name\fP the project name as passed to the command \fBproject_name\fP \-\- the project name as passed to the command
.IP \(bu 2 .IP \(bu 2
\fBproject_directory\fP the full path of the newly created project \fBproject_directory\fP \-\- the full path of the newly created project
.IP \(bu 2 .IP \(bu 2
\fBsecret_key\fP a random key for the \fBSECRET_KEY\fP setting \fBsecret_key\fP \-\- a random key for the \fBSECRET_KEY\fP setting
.IP \(bu 2 .IP \(bu 2
\fBdocs_version\fP the version of the documentation: \fB\(aqdev\(aq\fP or \fB\(aq1.x\(aq\fP \fBdocs_version\fP \-\- the version of the documentation: \fB\(aqdev\(aq\fP or \fB\(aq1.x\(aq\fP
.IP \(bu 2
\fBdjango_version\fP \-\- the version of Django, e.g.\(ga\(ga\(aq2.0.3\(aq\(ga\(ga
.UNINDENT .UNINDENT
.sp .sp
Please also see the \fI\%rendering warning\fP as mentioned Please also see the \fI\%rendering warning\fP as mentioned
@ -1824,14 +1826,12 @@ database before running the test suite.
.UNINDENT .UNINDENT
.sp .sp
Sorts test cases in the opposite execution order. This may help in debugging Sorts test cases in the opposite execution order. This may help in debugging
the side effects of tests that arent properly isolated. Grouping by test the side effects of tests that aren\(aqt properly isolated. Grouping by test
class is preserved when using this option. class is preserved when using this option.
.INDENT 0.0 .INDENT 0.0
.TP .TP
.B \-\-debug\-mode .B \-\-debug\-mode
.UNINDENT .UNINDENT
.sp
.sp .sp
Sets the \fBDEBUG\fP setting to \fBTrue\fP prior to running tests. This may Sets the \fBDEBUG\fP setting to \fBTrue\fP prior to running tests. This may
help troubleshoot test failures. help troubleshoot test failures.
@ -1852,7 +1852,7 @@ multiple cores, this allows running tests significantly faster.
.sp .sp
By default \fB\-\-parallel\fP runs one process per core according to By default \fB\-\-parallel\fP runs one process per core according to
\fI\%multiprocessing.cpu_count()\fP\&. You can adjust the number of processes \fI\%multiprocessing.cpu_count()\fP\&. You can adjust the number of processes
either by providing it as the options value, e.g. \fB\-\-parallel=4\fP, or by either by providing it as the option\(aqs value, e.g. \fB\-\-parallel=4\fP, or by
setting the \fBDJANGO_TEST_PROCESSES\fP environment variable. setting the \fBDJANGO_TEST_PROCESSES\fP environment variable.
.sp .sp
Django distributes test cases — \fI\%unittest.TestCase\fP subclasses — to Django distributes test cases — \fI\%unittest.TestCase\fP subclasses — to
@ -1860,7 +1860,7 @@ subprocesses. If there are fewer test cases than configured processes, Django
will reduce the number of processes accordingly. will reduce the number of processes accordingly.
.sp .sp
Each process gets its own database. You must ensure that different test cases Each process gets its own database. You must ensure that different test cases
dont access the same resources. For instance, test cases that touch the don\(aqt access the same resources. For instance, test cases that touch the
filesystem should create a temporary directory for their own use. filesystem should create a temporary directory for their own use.
.sp .sp
This option requires the third\-party \fBtblib\fP package to display tracebacks This option requires the third\-party \fBtblib\fP package to display tracebacks
@ -1876,12 +1876,12 @@ $ pip install tblib
.UNINDENT .UNINDENT
.UNINDENT .UNINDENT
.sp .sp
This feature isnt available on Windows. It doesnt work with the Oracle This feature isn\(aqt available on Windows. It doesn\(aqt work with the Oracle
database backend either. database backend either.
.sp .sp
If you want to use \fI\%pdb\fP while debugging tests, you must disable parallel If you want to use \fI\%pdb\fP while debugging tests, you must disable parallel
execution (\fB\-\-parallel=1\fP). Youll see something like \fBbdb.BdbQuit\fP if you execution (\fB\-\-parallel=1\fP). You\(aqll see something like \fBbdb.BdbQuit\fP if you
dont. don\(aqt.
.sp .sp
\fBWARNING:\fP \fBWARNING:\fP
.INDENT 0.0 .INDENT 0.0
@ -1931,7 +1931,7 @@ django\-admin testserver mydata.json
.UNINDENT .UNINDENT
.UNINDENT .UNINDENT
.sp .sp
would perform the following steps: \&...would perform the following steps:
.INDENT 0.0 .INDENT 0.0
.IP 1. 3 .IP 1. 3
Create a test database, as described in the\-test\-database\&. Create a test database, as described in the\-test\-database\&.
@ -1946,16 +1946,16 @@ this newly created test database instead of your production database.
This is useful in a number of ways: This is useful in a number of ways:
.INDENT 0.0 .INDENT 0.0
.IP \(bu 2 .IP \(bu 2
When youre writing unit tests of how your views When you\(aqre writing unit tests of how your views
act with certain fixture data, you can use \fBtestserver\fP to interact with act with certain fixture data, you can use \fBtestserver\fP to interact with
the views in a Web browser, manually. the views in a Web browser, manually.
.IP \(bu 2 .IP \(bu 2
Lets say youre developing your Django application and have a “pristine” Let\(aqs say you\(aqre developing your Django application and have a "pristine"
copy of a database that youd like to interact with. You can dump your copy of a database that you\(aqd like to interact with. You can dump your
database to a fixture (using the \fI\%dumpdata\fP command, explained database to a fixture (using the \fI\%dumpdata\fP command, explained
above), then use \fBtestserver\fP to run your Web application with that data. above), then use \fBtestserver\fP to run your Web application with that data.
With this arrangement, you have the flexibility of messing up your data With this arrangement, you have the flexibility of messing up your data
in any way, knowing that whatever data changes youre making are only in any way, knowing that whatever data changes you\(aqre making are only
being made to a test database. being made to a test database.
.UNINDENT .UNINDENT
.sp .sp
@ -1987,7 +1987,7 @@ django\-admin testserver fixture1 fixture2 \-\-addrport 7000
.UNINDENT .UNINDENT
.sp .sp
(The above statements are equivalent. We include both of them to demonstrate (The above statements are equivalent. We include both of them to demonstrate
that it doesnt matter whether the options come before or after the fixture that it doesn\(aqt matter whether the options come before or after the fixture
arguments.) arguments.)
.sp .sp
To run on 1.2.3.4:7000 with a \fBtest\fP fixture: To run on 1.2.3.4:7000 with a \fBtest\fP fixture:
@ -2021,9 +2021,9 @@ their application.
.B django\-admin changepassword [<username>] .B django\-admin changepassword [<username>]
.UNINDENT .UNINDENT
.sp .sp
This command is only available if Djangos authentication system (\fBdjango.contrib.auth\fP) is installed. This command is only available if Django\(aqs authentication system (\fBdjango.contrib.auth\fP) is installed.
.sp .sp
Allows changing a users password. It prompts you to enter a new password twice Allows changing a user\(aqs password. It prompts you to enter a new password twice
for the given user. If the entries are identical, this immediately becomes the for the given user. If the entries are identical, this immediately becomes the
new password. If you do not supply a user, the command will attempt to change new password. If you do not supply a user, the command will attempt to change
the password whose username matches the current user. the password whose username matches the current user.
@ -2051,7 +2051,7 @@ django\-admin changepassword ringo
.B django\-admin createsuperuser .B django\-admin createsuperuser
.UNINDENT .UNINDENT
.sp .sp
This command is only available if Djangos authentication system (\fBdjango.contrib.auth\fP) is installed. This command is only available if Django\(aqs authentication system (\fBdjango.contrib.auth\fP) is installed.
.sp .sp
Creates a superuser account (a user who has all permissions). This is Creates a superuser account (a user who has all permissions). This is
useful if you need to create an initial superuser account or if you need to useful if you need to create an initial superuser account or if you need to
@ -2083,7 +2083,7 @@ Specifies the database into which the superuser object will be saved.
.sp .sp
You can subclass the management command and override \fBget_input_data()\fP if you You can subclass the management command and override \fBget_input_data()\fP if you
want to customize data input and validation. Consult the source code for want to customize data input and validation. Consult the source code for
details on the existing implementation and the methods parameters. For example, details on the existing implementation and the method\(aqs parameters. For example,
it could be useful if you have a \fBForeignKey\fP in it could be useful if you have a \fBForeignKey\fP in
\fBREQUIRED_FIELDS\fP and want to \fBREQUIRED_FIELDS\fP and want to
allow creating an instance instead of entering the primary key of an existing allow creating an instance instead of entering the primary key of an existing
@ -2095,13 +2095,11 @@ instance.
.B django\-admin remove_stale_contenttypes .B django\-admin remove_stale_contenttypes
.UNINDENT .UNINDENT
.sp .sp
This command is only available if Django\(aqs contenttypes app (\fBdjango.contrib.contenttypes\fP) is installed.
.sp
This command is only available if Djangos contenttypes app (\fBdjango.contrib.contenttypes\fP) is installed.
.sp .sp
Deletes stale content types (from deleted models) in your database. Any objects Deletes stale content types (from deleted models) in your database. Any objects
that depend on the deleted content types will also be deleted. A list of that depend on the deleted content types will also be deleted. A list of
deleted objects will be displayed before you confirm its okay to proceed with deleted objects will be displayed before you confirm it\(aqs okay to proceed with
the deletion. the deletion.
.INDENT 0.0 .INDENT 0.0
.TP .TP
@ -2154,7 +2152,7 @@ allows for the following options:
.UNINDENT .UNINDENT
.sp .sp
Adds the given filesystem path to the Python \fI\%import search path\fP\&. If this Adds the given filesystem path to the Python \fI\%import search path\fP\&. If this
isnt provided, \fBdjango\-admin\fP will use the \fBPYTHONPATH\fP environment isn\(aqt provided, \fBdjango\-admin\fP will use the \fBPYTHONPATH\fP environment
variable. variable.
.sp .sp
This option is unnecessary in \fBmanage.py\fP, because it takes care of setting This option is unnecessary in \fBmanage.py\fP, because it takes care of setting
@ -2177,7 +2175,7 @@ django\-admin migrate \-\-pythonpath=\(aq/home/djangoprojects/myproject\(aq
.UNINDENT .UNINDENT
.sp .sp
Specifies the settings module to use. The settings module should be in Python Specifies the settings module to use. The settings module should be in Python
package syntax, e.g. \fBmysite.settings\fP\&. If this isnt provided, package syntax, e.g. \fBmysite.settings\fP\&. If this isn\(aqt provided,
\fBdjango\-admin\fP will use the \fBDJANGO_SETTINGS_MODULE\fP environment variable. \fBdjango\-admin\fP will use the \fBDJANGO_SETTINGS_MODULE\fP environment variable.
.sp .sp
This option is unnecessary in \fBmanage.py\fP, because it uses This option is unnecessary in \fBmanage.py\fP, because it uses
@ -2268,10 +2266,10 @@ django\-admin runserver \-\-no\-color
.sp .sp
The \fBdjango\-admin\fP / \fBmanage.py\fP commands will use pretty The \fBdjango\-admin\fP / \fBmanage.py\fP commands will use pretty
color\-coded output if your terminal supports ANSI\-colored output. It color\-coded output if your terminal supports ANSI\-colored output. It
wont use the color codes if youre piping the commands output to won\(aqt use the color codes if you\(aqre piping the command\(aqs output to
another program. another program.
.sp .sp
Under Windows, the native console doesnt support ANSI escape sequences so by Under Windows, the native console doesn\(aqt support ANSI escape sequences so by
default there is no color output. But you can install the \fI\%ANSICON\fP default there is no color output. But you can install the \fI\%ANSICON\fP
third\-party tool, the Django commands will detect its presence and will make third\-party tool, the Django commands will detect its presence and will make
use of its services to color output just like on Unix\-based platforms. use of its services to color output just like on Unix\-based platforms.
@ -2430,9 +2428,9 @@ overridden as specified.
.SS Bash completion .SS Bash completion
.sp .sp
If you use the Bash shell, consider installing the Django bash completion If you use the Bash shell, consider installing the Django bash completion
script, which lives in \fBextras/django_bash_completion\fP in the Django script, which lives in \fBextras/django_bash_completion\fP in the Django source
distribution. It enables tab\-completion of \fBdjango\-admin\fP and distribution. It enables tab\-completion of \fBdjango\-admin\fP and
\fBmanage.py\fP commands, so you can, for instance \fBmanage.py\fP commands, so you can, for instance...
.INDENT 0.0 .INDENT 0.0
.IP \(bu 2 .IP \(bu 2
Type \fBdjango\-admin\fP\&. Type \fBdjango\-admin\fP\&.
@ -2463,7 +2461,7 @@ line. For example, \fBcall_command(\(aqflush\(aq, \(aq\-\-verbosity=0\(aq)\fP\&.
.TP .TP
.B \fB**options\fP .B \fB**options\fP
named options accepted on the command\-line. Options are passed to the command named options accepted on the command\-line. Options are passed to the command
without triggering the argument parser, which means youll need to pass the without triggering the argument parser, which means you\(aqll need to pass the
correct type. For example, \fBcall_command(\(aqflush\(aq, verbosity=0)\fP (zero must correct type. For example, \fBcall_command(\(aqflush\(aq, verbosity=0)\fP (zero must
be an integer rather than a string). be an integer rather than a string).
.UNINDENT .UNINDENT
@ -2512,7 +2510,7 @@ Some command options have different names when using \fBcall_command()\fP instea
of \fBdjango\-admin\fP or \fBmanage.py\fP\&. For example, \fBdjango\-admin of \fBdjango\-admin\fP or \fBmanage.py\fP\&. For example, \fBdjango\-admin
createsuperuser \-\-no\-input\fP translates to \fBcall_command(\(aqcreatesuperuser\(aq, createsuperuser \-\-no\-input\fP translates to \fBcall_command(\(aqcreatesuperuser\(aq,
interactive=False)\fP\&. To find what keyword argument name to use for interactive=False)\fP\&. To find what keyword argument name to use for
\fBcall_command()\fP, check the commands source code for the \fBdest\fP argument \fBcall_command()\fP, check the command\(aqs source code for the \fBdest\fP argument
passed to \fBparser.add_argument()\fP\&. passed to \fBparser.add_argument()\fP\&.
.sp .sp
Command options which take multiple options are passed a list: Command options which take multiple options are passed a list: