|
@@ -1,6 +1,6 @@
|
|
|
.\" 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
|
|
|
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
|
|
|
..
|
|
|
.sp
|
|
|
-\fBdjango\-admin\fP is Django’s 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.
|
|
|
.sp
|
|
|
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:
|
|
|
.INDENT 0.0
|
|
|
.IP \(bu 2
|
|
|
-It puts your project’s package on \fBsys.path\fP\&.
|
|
|
+It puts your project\(aqs package on \fBsys.path\fP\&.
|
|
|
.IP \(bu 2
|
|
|
It sets the \fBDJANGO_SETTINGS_MODULE\fP environment variable so that
|
|
|
-it points to your project’s \fBsettings.py\fP file.
|
|
|
+it points to your project\(aqs \fBsettings.py\fP file.
|
|
|
.UNINDENT
|
|
|
.sp
|
|
|
The \fBdjango\-admin\fP script should be on your system path if you installed
|
|
|
-Django via its \fBsetup.py\fP utility. If it’s 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
|
|
|
symlinking it from some place on your path, such as \fB/usr/local/bin\fP\&.
|
|
|
.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 \-
|
|
|
Environment...\fP) to point to its installed location.
|
|
|
.sp
|
|
|
-Generally, when working on a single Django project, it’s 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
|
|
|
Django settings files, use \fBdjango\-admin\fP with
|
|
|
\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.
|
|
|
.SS App names
|
|
|
.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
|
|
|
contains the string \fB\(aqmysite.blog\(aq\fP, the app name is \fBblog\fP\&.
|
|
|
.SS Determining the version
|
|
@@ -298,7 +298,7 @@ For Oracle, this runs the \fBsqlplus\fP command\-line client.
|
|
|
.sp
|
|
|
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
|
|
|
-program in the right place. There’s 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.
|
|
|
.INDENT 0.0
|
|
|
.TP
|
|
@@ -312,11 +312,11 @@ Specifies the database onto which to open a shell. Defaults to \fBdefault\fP\&.
|
|
|
.B django\-admin diffsettings
|
|
|
.UNINDENT
|
|
|
.sp
|
|
|
-Displays differences between the current settings file and Django’s default
|
|
|
+Displays differences between the current settings file and Django\(aqs default
|
|
|
settings (or another settings file specified by \fI\%\-\-default\fP).
|
|
|
.sp
|
|
|
-Settings that don’t appear in the defaults are followed by \fB"###"\fP\&. For
|
|
|
-example, the default settings don’t define \fBROOT_URLCONF\fP, so
|
|
|
+Settings that don\(aqt appear in the defaults are followed by \fB"###"\fP\&. For
|
|
|
+example, the default settings don\(aqt define \fBROOT_URLCONF\fP, so
|
|
|
\fBROOT_URLCONF\fP is followed by \fB"###"\fP in the output of
|
|
|
\fBdiffsettings\fP\&.
|
|
|
.INDENT 0.0
|
|
@@ -324,17 +324,15 @@ example, the default settings don’t define \fBROOT_URLCONF\fP, so
|
|
|
.B \-\-all
|
|
|
.UNINDENT
|
|
|
.sp
|
|
|
-Displays all settings, even if they have Django’s default value. Such settings
|
|
|
+Displays all settings, even if they have Django\(aqs default value. Such settings
|
|
|
are prefixed by \fB"###"\fP\&.
|
|
|
.INDENT 0.0
|
|
|
.TP
|
|
|
.B \-\-default MODULE
|
|
|
.UNINDENT
|
|
|
-.sp
|
|
|
-
|
|
|
.sp
|
|
|
The settings module to compare the current settings against. Leave empty to
|
|
|
-compare against Django’s default settings.
|
|
|
+compare against Django\(aqs default settings.
|
|
|
.INDENT 0.0
|
|
|
.TP
|
|
|
.B \-\-output {hash,unified}
|
|
@@ -343,7 +341,7 @@ compare against Django’s default settings.
|
|
|
|
|
|
.sp
|
|
|
Specifies the output format. Available values are \fBhash\fP and \fBunified\fP\&.
|
|
|
-\fBhash\fP is the default mode that displays the output that’s 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
|
|
|
prefixed with a minus sign, followed by the changed setting prefixed with a
|
|
|
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\&.
|
|
|
.sp
|
|
|
Note that \fBdumpdata\fP uses the default manager on the model for selecting the
|
|
|
-records to dump. If you’re 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
|
|
|
objects will be dumped.
|
|
|
.INDENT 0.0
|
|
@@ -369,7 +367,7 @@ objects will be dumped.
|
|
|
.B \-\-all, \-a
|
|
|
.UNINDENT
|
|
|
.sp
|
|
|
-Uses Django’s 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.
|
|
|
.INDENT 0.0
|
|
|
.TP
|
|
@@ -420,7 +418,7 @@ Specifies the database from which data will be dumped. Defaults to \fBdefault\fP
|
|
|
.sp
|
|
|
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
|
|
|
-you’re 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
|
|
|
flag. See the natural keys
|
|
|
documentation for more details on this and the next option.
|
|
@@ -480,10 +478,13 @@ Specifies the database to flush. Defaults to \fBdefault\fP\&.
|
|
|
.sp
|
|
|
Introspects the database tables in the database pointed\-to by the
|
|
|
\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
|
|
|
-their names as arguments.
|
|
|
+file) to standard output.
|
|
|
+.sp
|
|
|
+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’d like to use Django.
|
|
|
+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
|
|
|
it.
|
|
|
.sp
|
|
@@ -492,7 +493,7 @@ in the table. Note that \fBinspectdb\fP has a few special cases in its field\-na
|
|
|
output:
|
|
|
.INDENT 0.0
|
|
|
.IP \(bu 2
|
|
|
-If \fBinspectdb\fP cannot map a column’s type to a model field type, it’ll
|
|
|
+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
|
|
|
\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
|
|
@@ -510,8 +511,8 @@ field.
|
|
|
.UNINDENT
|
|
|
.sp
|
|
|
This feature is meant as a shortcut, not as definitive model generation. After
|
|
|
-you run it, you’ll want to look over the generated models yourself to make
|
|
|
-customizations. In particular, you’ll need to rearrange models’ order, so that
|
|
|
+you run it, you\(aqll want to look over the generated models yourself to make
|
|
|
+customizations. In particular, you\(aqll need to rearrange models\(aq order, so that
|
|
|
models that refer to other models are ordered properly.
|
|
|
.sp
|
|
|
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
|
|
|
only works in PostgreSQL and with certain types of MySQL tables.
|
|
|
.sp
|
|
|
-Django doesn’t create database defaults when a
|
|
|
+Django doesn\(aqt create database defaults when a
|
|
|
\fBdefault\fP is specified on a model field.
|
|
|
-Similarly, database defaults aren’t translated to model field defaults or
|
|
|
+Similarly, database defaults aren\(aqt translated to model field defaults or
|
|
|
detected in any fashion by \fBinspectdb\fP\&.
|
|
|
.sp
|
|
|
By default, \fBinspectdb\fP creates unmanaged models. That is, \fBmanaged = False\fP
|
|
|
-in the model’s \fBMeta\fP class tells Django not to manage each table’s 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
|
|
|
-table’s lifecycle, you’ll need to change the
|
|
|
+table\(aqs lifecycle, you\(aqll need to change the
|
|
|
\fBmanaged\fP option to \fBTrue\fP (or simply remove
|
|
|
it because \fBTrue\fP is its default value).
|
|
|
.INDENT 0.0
|
|
@@ -538,6 +539,14 @@ it because \fBTrue\fP is its default value).
|
|
|
.UNINDENT
|
|
|
.sp
|
|
|
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
|
|
|
.INDENT 0.0
|
|
|
.TP
|
|
@@ -578,13 +587,11 @@ Specifies the serialization format (e.g.,
|
|
|
.TP
|
|
|
.B \-\-exclude EXCLUDE, \-e EXCLUDE
|
|
|
.UNINDENT
|
|
|
-.sp
|
|
|
-
|
|
|
.sp
|
|
|
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
|
|
|
times to exclude more than one app or model.
|
|
|
-.SS What’s a “fixture”?
|
|
|
+.SS What\(aqs a "fixture"?
|
|
|
.sp
|
|
|
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
|
|
@@ -660,7 +667,7 @@ any \fBpre_save\fP or
|
|
|
\fBpost_save\fP signals will be called with
|
|
|
\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
|
|
|
-related fields that aren’t present during fixture loading and would otherwise
|
|
|
+related fields that aren\(aqt present during fixture loading and would otherwise
|
|
|
raise an exception:
|
|
|
.INDENT 0.0
|
|
|
.INDENT 3.5
|
|
@@ -746,18 +753,18 @@ installation will be aborted, and any data installed in the call to
|
|
|
.INDENT 3.5
|
|
|
.IP "MySQL with MyISAM and fixtures"
|
|
|
.sp
|
|
|
-The MyISAM storage engine of MySQL doesn’t support transactions or
|
|
|
-constraints, so if you use MyISAM, you won’t get validation of fixture
|
|
|
+The MyISAM storage engine of MySQL doesn\(aqt support transactions or
|
|
|
+constraints, so if you use MyISAM, you won\(aqt get validation of fixture
|
|
|
data, or a rollback if multiple transaction files are found.
|
|
|
.UNINDENT
|
|
|
.UNINDENT
|
|
|
.SS Database\-specific fixtures
|
|
|
.sp
|
|
|
-If you’re 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
|
|
|
situation, you can add a database identifier into the names of your fixtures.
|
|
|
.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
|
|
|
\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.
|
|
@@ -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
|
|
|
the i18n documentation for details.
|
|
|
.sp
|
|
|
-This command doesn’t require configured settings. However, when settings aren’t
|
|
|
-configured, the command can’t ignore the \fBMEDIA_ROOT\fP and
|
|
|
+This command doesn\(aqt require configured settings. However, when settings aren\(aqt
|
|
|
+configured, the command can\(aqt ignore the \fBMEDIA_ROOT\fP and
|
|
|
\fBSTATIC_ROOT\fP directories or include \fBLOCALE_PATHS\fP\&. It will
|
|
|
also write files in UTF\-8 rather than in \fBFILE_CHARSET\fP\&.
|
|
|
.INDENT 0.0
|
|
@@ -949,9 +956,9 @@ Disables breaking long message lines into several lines in language files.
|
|
|
.B \-\-no\-location
|
|
|
.UNINDENT
|
|
|
.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
|
|
|
-understand each message’s context.
|
|
|
+understand each message\(aqs context.
|
|
|
.INDENT 0.0
|
|
|
.TP
|
|
|
.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
|
|
|
of a \fBForeignKey\fP, for example).
|
|
|
.sp
|
|
|
-To add migrations to an app that doesn’t have a \fBmigrations\fP directory, run
|
|
|
-\fBmakemigrations\fP with the app’s \fBapp_label\fP\&.
|
|
|
+To add migrations to an app that doesn\(aqt have a \fBmigrations\fP directory, run
|
|
|
+\fBmakemigrations\fP with the app\(aqs \fBapp_label\fP\&.
|
|
|
.INDENT 0.0
|
|
|
.TP
|
|
|
.B \-\-noinput, \-\-no\-input
|
|
@@ -1040,9 +1047,6 @@ Enables fixing of migration conflicts.
|
|
|
.UNINDENT
|
|
|
.sp
|
|
|
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
|
|
|
.TP
|
|
|
.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.
|
|
|
.IP \(bu 2
|
|
|
\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.
|
|
|
.IP \(bu 2
|
|
|
\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
|
|
|
.UNINDENT
|
|
|
.sp
|
|
|
-Tells Django to mark the migrations as having been applied or unapplied, but
|
|
|
-without actually running the SQL to change your database schema.
|
|
|
+Marks the migrations up to the target one (following the rules above) as
|
|
|
+applied, but without actually running the SQL to change your database schema.
|
|
|
.sp
|
|
|
This is intended for advanced users to manipulate the
|
|
|
-current migration state directly if they’re 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
|
|
|
table into a state where manual recovery will be needed to make migrations
|
|
|
run correctly.
|
|
@@ -1099,7 +1103,7 @@ run correctly.
|
|
|
.B \-\-fake\-initial
|
|
|
.UNINDENT
|
|
|
.sp
|
|
|
-Allows Django to skip an app’s 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
|
|
|
\fBCreateModel\fP operations in that
|
|
|
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
|
|
|
.UNINDENT
|
|
|
.sp
|
|
|
-Allows creating tables for apps without migrations. While this isn’t
|
|
|
+Allows creating tables for apps without migrations. While this isn\(aqt
|
|
|
recommended, the migrations framework is sometimes too slow on large projects
|
|
|
with hundreds of models.
|
|
|
.INDENT 0.0
|
|
@@ -1140,14 +1144,14 @@ This server uses the WSGI application object specified by the
|
|
|
\fBWSGI_APPLICATION\fP setting.
|
|
|
.sp
|
|
|
DO NOT USE THIS SERVER IN A PRODUCTION SETTING. It has not gone through
|
|
|
-security audits or performance tests. (And that’s how it’s gonna stay. We’re 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
|
|
|
server to be able to handle a production environment is outside the scope of
|
|
|
Django.)
|
|
|
.sp
|
|
|
The development server automatically reloads Python code for each request, as
|
|
|
-needed. You don’t need to restart the server for code changes to take effect.
|
|
|
-However, some actions like adding files don’t trigger a restart, so you’ll
|
|
|
+needed. You don\(aqt need to restart the server for code changes to take effect.
|
|
|
+However, some actions like adding files don\(aqt trigger a restart, so you\(aqll
|
|
|
have to restart the server in these cases.
|
|
|
.sp
|
|
|
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
|
|
|
errors are found, they will be printed to standard output.
|
|
|
.sp
|
|
|
-You can run as many concurrent servers as you want, as long as they’re 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.
|
|
|
.sp
|
|
|
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
|
|
|
.SS Serving static files with the development server
|
|
|
.sp
|
|
|
-By default, the development server doesn’t 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
|
|
|
you want to configure Django to serve static media, read
|
|
|
/howto/static\-files/index\&.
|
|
@@ -1391,7 +1395,7 @@ django\-admin shell \-i bpython
|
|
|
.UNINDENT
|
|
|
.UNINDENT
|
|
|
.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:
|
|
|
.INDENT 0.0
|
|
|
.INDENT 3.5
|
|
@@ -1408,7 +1412,7 @@ django\-admin shell \-i python
|
|
|
.B \-\-nostartup
|
|
|
.UNINDENT
|
|
|
.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
|
|
|
variable or the \fB~/.pythonrc.py\fP script is read.
|
|
|
.INDENT 0.0
|
|
@@ -1445,9 +1449,6 @@ $ django\-admin shell <<EOF
|
|
|
.sp
|
|
|
On Windows, the REPL is output due to implementation limits of
|
|
|
\fI\%select.select()\fP on that platform.
|
|
|
-.sp
|
|
|
-In older versions, the REPL is also output on UNIX systems.
|
|
|
-
|
|
|
.SS \fBshowmigrations\fP
|
|
|
.INDENT 0.0
|
|
|
.TP
|
|
@@ -1479,9 +1480,6 @@ of 2 and above, all dependencies of a migration will also be shown.
|
|
|
.sp
|
|
|
\fBapp_label\fPs arguments limit the output, however, dependencies of provided
|
|
|
apps may also be included.
|
|
|
-.sp
|
|
|
-In older versions, \fBshowmigrations \-\-plan\fP ignores app labels.
|
|
|
-
|
|
|
.INDENT 0.0
|
|
|
.TP
|
|
|
.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
|
|
|
generate the SQL against a copy of the database you wish to later apply it on.
|
|
|
.sp
|
|
|
-Note that \fBsqlmigrate\fP doesn’t colorize its output.
|
|
|
+Note that \fBsqlmigrate\fP doesn\(aqt colorize its output.
|
|
|
.INDENT 0.0
|
|
|
.TP
|
|
|
.B \-\-backwards
|
|
@@ -1600,7 +1598,7 @@ name is given, the app directory will be created in the current working
|
|
|
directory.
|
|
|
.sp
|
|
|
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.
|
|
|
.sp
|
|
|
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
|
|
|
fly.
|
|
|
.sp
|
|
|
-For example, taking advantage of GitHub’s 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:
|
|
|
.INDENT 0.0
|
|
|
.INDENT 3.5
|
|
@@ -1672,16 +1670,18 @@ The \fBtemplate context\fP used for all matching
|
|
|
files is:
|
|
|
.INDENT 0.0
|
|
|
.IP \(bu 2
|
|
|
-Any option passed to the \fBstartapp\fP command (among the command’s supported
|
|
|
+Any option passed to the \fBstartapp\fP command (among the command\(aqs supported
|
|
|
options)
|
|
|
.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
|
|
|
+\fBapp_directory\fP \-\- the full path of the newly created app
|
|
|
.IP \(bu 2
|
|
|
-\fBapp_directory\fP – the full path of the newly created app
|
|
|
+\fBcamel_case_app_name\fP \-\- the app name in camel case format
|
|
|
.IP \(bu 2
|
|
|
-\fBcamel_case_app_name\fP – the app name in camel case format
|
|
|
+\fBdocs_version\fP \-\- the version of the documentation: \fB\(aqdev\(aq\fP or \fB\(aq1.x\(aq\fP
|
|
|
.IP \(bu 2
|
|
|
-\fBdocs_version\fP – the version of the documentation: \fB\(aqdev\(aq\fP or \fB\(aq1.x\(aq\fP
|
|
|
+\fBdjango_version\fP \-\- the version of Django, e.g.\(ga\(ga\(aq2.0.3\(aq\(ga\(ga
|
|
|
.UNINDENT
|
|
|
.sp
|
|
|
\fBWARNING:\fP
|
|
@@ -1694,7 +1694,7 @@ contains a docstring explaining a particular feature related
|
|
|
to template rendering, it might result in an incorrect example.
|
|
|
.sp
|
|
|
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
|
|
|
In addition, to allow Python template files that contain Django template
|
|
|
language syntax while also preventing packaging systems from trying to
|
|
@@ -1721,7 +1721,7 @@ will be created in the current working directory.
|
|
|
.sp
|
|
|
If the optional destination is provided, Django will use that existing
|
|
|
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
|
|
|
For example:
|
|
|
.INDENT 0.0
|
|
@@ -1760,16 +1760,18 @@ empty list.
|
|
|
The \fBtemplate context\fP used is:
|
|
|
.INDENT 0.0
|
|
|
.IP \(bu 2
|
|
|
-Any option passed to the \fBstartproject\fP command (among the command’s
|
|
|
+Any option passed to the \fBstartproject\fP command (among the command\(aqs
|
|
|
supported options)
|
|
|
.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
|
|
|
-\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
|
|
|
-\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
|
|
|
-\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
|
|
|
.sp
|
|
|
Please also see the \fI\%rendering warning\fP as mentioned
|
|
@@ -1824,14 +1826,12 @@ database before running the test suite.
|
|
|
.UNINDENT
|
|
|
.sp
|
|
|
Sorts test cases in the opposite execution order. This may help in debugging
|
|
|
-the side effects of tests that aren’t 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.
|
|
|
.INDENT 0.0
|
|
|
.TP
|
|
|
.B \-\-debug\-mode
|
|
|
.UNINDENT
|
|
|
-.sp
|
|
|
-
|
|
|
.sp
|
|
|
Sets the \fBDEBUG\fP setting to \fBTrue\fP prior to running tests. This may
|
|
|
help troubleshoot test failures.
|
|
@@ -1852,7 +1852,7 @@ multiple cores, this allows running tests significantly faster.
|
|
|
.sp
|
|
|
By default \fB\-\-parallel\fP runs one process per core according to
|
|
|
\fI\%multiprocessing.cpu_count()\fP\&. You can adjust the number of processes
|
|
|
-either by providing it as the option’s 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.
|
|
|
.sp
|
|
|
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.
|
|
|
.sp
|
|
|
Each process gets its own database. You must ensure that different test cases
|
|
|
-don’t 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.
|
|
|
.sp
|
|
|
This option requires the third\-party \fBtblib\fP package to display tracebacks
|
|
@@ -1876,12 +1876,12 @@ $ pip install tblib
|
|
|
.UNINDENT
|
|
|
.UNINDENT
|
|
|
.sp
|
|
|
-This feature isn’t available on Windows. It doesn’t work with the Oracle
|
|
|
+This feature isn\(aqt available on Windows. It doesn\(aqt work with the Oracle
|
|
|
database backend either.
|
|
|
.sp
|
|
|
If you want to use \fI\%pdb\fP while debugging tests, you must disable parallel
|
|
|
-execution (\fB\-\-parallel=1\fP). You’ll see something like \fBbdb.BdbQuit\fP if you
|
|
|
-don’t.
|
|
|
+execution (\fB\-\-parallel=1\fP). You\(aqll see something like \fBbdb.BdbQuit\fP if you
|
|
|
+don\(aqt.
|
|
|
.sp
|
|
|
\fBWARNING:\fP
|
|
|
.INDENT 0.0
|
|
@@ -1931,7 +1931,7 @@ django\-admin testserver mydata.json
|
|
|
.UNINDENT
|
|
|
.UNINDENT
|
|
|
.sp
|
|
|
-…would perform the following steps:
|
|
|
+\&...would perform the following steps:
|
|
|
.INDENT 0.0
|
|
|
.IP 1. 3
|
|
|
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:
|
|
|
.INDENT 0.0
|
|
|
.IP \(bu 2
|
|
|
-When you’re 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
|
|
|
the views in a Web browser, manually.
|
|
|
.IP \(bu 2
|
|
|
-Let’s say you’re developing your Django application and have a “pristine”
|
|
|
-copy of a database that you’d like to interact with. You can dump your
|
|
|
+Let\(aqs say you\(aqre developing your Django application and have a "pristine"
|
|
|
+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
|
|
|
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
|
|
|
-in any way, knowing that whatever data changes you’re making are only
|
|
|
+in any way, knowing that whatever data changes you\(aqre making are only
|
|
|
being made to a test database.
|
|
|
.UNINDENT
|
|
|
.sp
|
|
@@ -1987,7 +1987,7 @@ django\-admin testserver fixture1 fixture2 \-\-addrport 7000
|
|
|
.UNINDENT
|
|
|
.sp
|
|
|
(The above statements are equivalent. We include both of them to demonstrate
|
|
|
-that it doesn’t 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.)
|
|
|
.sp
|
|
|
To run on 1.2.3.4:7000 with a \fBtest\fP fixture:
|
|
@@ -2021,9 +2021,9 @@ their application.
|
|
|
.B django\-admin changepassword [<username>]
|
|
|
.UNINDENT
|
|
|
.sp
|
|
|
-This command is only available if Django’s 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
|
|
|
-Allows changing a user’s 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
|
|
|
new password. If you do not supply a user, the command will attempt to change
|
|
|
the password whose username matches the current user.
|
|
@@ -2051,7 +2051,7 @@ django\-admin changepassword ringo
|
|
|
.B django\-admin createsuperuser
|
|
|
.UNINDENT
|
|
|
.sp
|
|
|
-This command is only available if Django’s 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
|
|
|
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
|
|
@@ -2083,7 +2083,7 @@ Specifies the database into which the superuser object will be saved.
|
|
|
.sp
|
|
|
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
|
|
|
-details on the existing implementation and the method’s 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
|
|
|
\fBREQUIRED_FIELDS\fP and want to
|
|
|
allow creating an instance instead of entering the primary key of an existing
|
|
@@ -2095,13 +2095,11 @@ instance.
|
|
|
.B django\-admin remove_stale_contenttypes
|
|
|
.UNINDENT
|
|
|
.sp
|
|
|
-
|
|
|
-.sp
|
|
|
-This command is only available if Django’s contenttypes app (\fBdjango.contrib.contenttypes\fP) is installed.
|
|
|
+This command is only available if Django\(aqs contenttypes app (\fBdjango.contrib.contenttypes\fP) is installed.
|
|
|
.sp
|
|
|
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
|
|
|
-deleted objects will be displayed before you confirm it’s okay to proceed with
|
|
|
+deleted objects will be displayed before you confirm it\(aqs okay to proceed with
|
|
|
the deletion.
|
|
|
.INDENT 0.0
|
|
|
.TP
|
|
@@ -2154,7 +2152,7 @@ allows for the following options:
|
|
|
.UNINDENT
|
|
|
.sp
|
|
|
Adds the given filesystem path to the Python \fI\%import search path\fP\&. If this
|
|
|
-isn’t provided, \fBdjango\-admin\fP will use the \fBPYTHONPATH\fP environment
|
|
|
+isn\(aqt provided, \fBdjango\-admin\fP will use the \fBPYTHONPATH\fP environment
|
|
|
variable.
|
|
|
.sp
|
|
|
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
|
|
|
.sp
|
|
|
Specifies the settings module to use. The settings module should be in Python
|
|
|
-package syntax, e.g. \fBmysite.settings\fP\&. If this isn’t 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.
|
|
|
.sp
|
|
|
This option is unnecessary in \fBmanage.py\fP, because it uses
|
|
@@ -2268,10 +2266,10 @@ django\-admin runserver \-\-no\-color
|
|
|
.sp
|
|
|
The \fBdjango\-admin\fP / \fBmanage.py\fP commands will use pretty
|
|
|
color\-coded output if your terminal supports ANSI\-colored output. It
|
|
|
-won’t use the color codes if you’re piping the command’s output to
|
|
|
+won\(aqt use the color codes if you\(aqre piping the command\(aqs output to
|
|
|
another program.
|
|
|
.sp
|
|
|
-Under Windows, the native console doesn’t 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
|
|
|
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.
|
|
@@ -2430,9 +2428,9 @@ overridden as specified.
|
|
|
.SS Bash completion
|
|
|
.sp
|
|
|
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
|
|
|
-\fBmanage.py\fP commands, so you can, for instance…
|
|
|
+\fBmanage.py\fP commands, so you can, for instance...
|
|
|
.INDENT 0.0
|
|
|
.IP \(bu 2
|
|
|
Type \fBdjango\-admin\fP\&.
|
|
@@ -2463,7 +2461,7 @@ line. For example, \fBcall_command(\(aqflush\(aq, \(aq\-\-verbosity=0\(aq)\fP\&.
|
|
|
.TP
|
|
|
.B \fB**options\fP
|
|
|
named options accepted on the command\-line. Options are passed to the command
|
|
|
-without triggering the argument parser, which means you’ll 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
|
|
|
be an integer rather than a string).
|
|
|
.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
|
|
|
createsuperuser \-\-no\-input\fP translates to \fBcall_command(\(aqcreatesuperuser\(aq,
|
|
|
interactive=False)\fP\&. To find what keyword argument name to use for
|
|
|
-\fBcall_command()\fP, check the command’s 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\&.
|
|
|
.sp
|
|
|
Command options which take multiple options are passed a list:
|