mirror of
https://github.com/django/django.git
synced 2025-01-03 06:55:47 +00:00
Updated man page for Django 5.0 alpha.
This commit is contained in:
parent
cac94dd8aa
commit
3eb7051161
@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
|||||||
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
.\" new: \\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
|
||||||
..
|
..
|
||||||
.TH "DJANGO-ADMIN" "1" "January 15, 2023" "4.2" "Django"
|
.TH "DJANGO-ADMIN" "1" "September 18, 2023" "5.0" "Django"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
django-admin \- Utility script for the Django web framework
|
django-admin \- Utility script for the Django web framework
|
||||||
.sp
|
.sp
|
||||||
@ -85,7 +85,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 \(dqapp names.\(dq An \(dqapp name\(dq is the basename of
|
||||||
the package containing your models. For example, if your \fI\%INSTALLED_APPS\fP
|
the package containing your models. For example, if your \fI\%INSTALLED_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
|
||||||
@ -358,7 +358,7 @@ On MySQL/MariaDB, you can do this with the \fBmysql\fP command\(aqs \fB\-e\fP fl
|
|||||||
.sp
|
.sp
|
||||||
.nf
|
.nf
|
||||||
.ft C
|
.ft C
|
||||||
$ django\-admin dbshell \-\- \-e "select user()"
|
$ django\-admin dbshell \-\- \-e \(dqselect user()\(dq
|
||||||
+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
|
+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
|
||||||
| user() |
|
| user() |
|
||||||
+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
|
+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
|
||||||
@ -386,9 +386,9 @@ command\-line client, e.g. \fB\(aqisolation_level\(aq\fP\&.
|
|||||||
Displays differences between the current settings file and Django\(aqs 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 don\(aqt appear in the defaults are followed by \fB"###"\fP\&. For
|
Settings that don\(aqt appear in the defaults are followed by \fB\(dq###\(dq\fP\&. For
|
||||||
example, the default settings don\(aqt define \fI\%ROOT_URLCONF\fP, so
|
example, the default settings don\(aqt define \fI\%ROOT_URLCONF\fP, so
|
||||||
\fI\%ROOT_URLCONF\fP is followed by \fB"###"\fP in the output of
|
\fI\%ROOT_URLCONF\fP is followed by \fB\(dq###\(dq\fP in the output of
|
||||||
\fBdiffsettings\fP\&.
|
\fBdiffsettings\fP\&.
|
||||||
.INDENT 0.0
|
.INDENT 0.0
|
||||||
.TP
|
.TP
|
||||||
@ -396,7 +396,7 @@ example, the default settings don\(aqt define \fI\%ROOT_URLCONF\fP, so
|
|||||||
.UNINDENT
|
.UNINDENT
|
||||||
.sp
|
.sp
|
||||||
Displays all settings, even if they have Django\(aqs 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\(dq###\(dq\fP\&.
|
||||||
.INDENT 0.0
|
.INDENT 0.0
|
||||||
.TP
|
.TP
|
||||||
.B \-\-default MODULE
|
.B \-\-default MODULE
|
||||||
@ -914,6 +914,12 @@ line number.
|
|||||||
Requires \fBgettext\fP 0.19 or newer.
|
Requires \fBgettext\fP 0.19 or newer.
|
||||||
.INDENT 0.0
|
.INDENT 0.0
|
||||||
.TP
|
.TP
|
||||||
|
.B \-\-no\-obsolete
|
||||||
|
.UNINDENT
|
||||||
|
.sp
|
||||||
|
Removes obsolete message strings from the \fB\&.po\fP files.
|
||||||
|
.INDENT 0.0
|
||||||
|
.TP
|
||||||
.B \-\-keep\-pot
|
.B \-\-keep\-pot
|
||||||
.UNINDENT
|
.UNINDENT
|
||||||
.sp
|
.sp
|
||||||
@ -1002,8 +1008,6 @@ In older versions, the missing migrations were also created when using the
|
|||||||
.TP
|
.TP
|
||||||
.B \-\-scriptable
|
.B \-\-scriptable
|
||||||
.UNINDENT
|
.UNINDENT
|
||||||
.sp
|
|
||||||
|
|
||||||
.sp
|
.sp
|
||||||
Diverts log output and input prompts to \fBstderr\fP, writing only paths of
|
Diverts log output and input prompts to \fBstderr\fP, writing only paths of
|
||||||
generated migration files to \fBstdout\fP\&.
|
generated migration files to \fBstdout\fP\&.
|
||||||
@ -1016,6 +1020,9 @@ generated migration files to \fBstdout\fP\&.
|
|||||||
.sp
|
.sp
|
||||||
Merges model changes into the latest migration and optimize the resulting
|
Merges model changes into the latest migration and optimize the resulting
|
||||||
operations.
|
operations.
|
||||||
|
.sp
|
||||||
|
The updated migration will have a generated name. In order to preserve the
|
||||||
|
previous name, set it using \fB\-\-name\fP\&.
|
||||||
.SS \fBmigrate\fP
|
.SS \fBmigrate\fP
|
||||||
.INDENT 0.0
|
.INDENT 0.0
|
||||||
.TP
|
.TP
|
||||||
@ -1117,15 +1124,11 @@ detected.
|
|||||||
.TP
|
.TP
|
||||||
.B \-\-prune
|
.B \-\-prune
|
||||||
.UNINDENT
|
.UNINDENT
|
||||||
.sp
|
|
||||||
|
|
||||||
.sp
|
.sp
|
||||||
Deletes nonexistent migrations from the \fBdjango_migrations\fP table. This is
|
Deletes nonexistent migrations from the \fBdjango_migrations\fP table. This is
|
||||||
useful when migration files replaced by a squashed migration have been removed.
|
useful when migration files replaced by a squashed migration have been removed.
|
||||||
See \fI\%Squashing migrations\fP for more details.
|
See \fI\%Squashing migrations\fP for more details.
|
||||||
.SS \fBoptimizemigration\fP
|
.SS \fBoptimizemigration\fP
|
||||||
.sp
|
|
||||||
|
|
||||||
.INDENT 0.0
|
.INDENT 0.0
|
||||||
.TP
|
.TP
|
||||||
.B django\-admin optimizemigration app_label migration_name
|
.B django\-admin optimizemigration app_label migration_name
|
||||||
@ -1361,6 +1364,11 @@ By default, the development server doesn\(aqt serve any static files for your si
|
|||||||
(such as CSS files, images, things under \fI\%MEDIA_URL\fP and so forth). If
|
(such as CSS files, images, things under \fI\%MEDIA_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
|
||||||
\fI\%How to manage static files (e.g. images, JavaScript, CSS)\fP\&.
|
\fI\%How to manage static files (e.g. images, JavaScript, CSS)\fP\&.
|
||||||
|
.SS Serving with ASGI in development
|
||||||
|
.sp
|
||||||
|
Django\(aqs \fBrunserver\fP command provides a WSGI server. In order to run under
|
||||||
|
ASGI you will need to use an \fI\%ASGI server\fP\&.
|
||||||
|
The Django Daphne project provides \fI\%Integration with runserver\fP that you can use.
|
||||||
.SS \fBsendtestemail\fP
|
.SS \fBsendtestemail\fP
|
||||||
.INDENT 0.0
|
.INDENT 0.0
|
||||||
.TP
|
.TP
|
||||||
@ -1435,7 +1443,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 \(dqrich\(dq shell installed but want to force use of the \(dqplain\(dq
|
||||||
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
|
||||||
@ -1452,7 +1460,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 \(dqplain\(dq 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
|
||||||
@ -1466,7 +1474,7 @@ Lets you pass a command as a string to execute it as Django, like so:
|
|||||||
.sp
|
.sp
|
||||||
.nf
|
.nf
|
||||||
.ft C
|
.ft C
|
||||||
django\-admin shell \-\-command="import django; print(django.__version__)"
|
django\-admin shell \-\-command=\(dqimport django; print(django.__version__)\(dq
|
||||||
.ft P
|
.ft P
|
||||||
.fi
|
.fi
|
||||||
.UNINDENT
|
.UNINDENT
|
||||||
@ -1747,7 +1755,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 \fI\%templatetag\fP
|
To work around this problem, you can use the \fI\%templatetag\fP
|
||||||
template tag to "escape" the various parts of the template syntax.
|
template tag to \(dqescape\(dq 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
|
||||||
@ -2057,6 +2065,21 @@ tests, which allows it to print a traceback if the interpreter crashes. Pass
|
|||||||
.UNINDENT
|
.UNINDENT
|
||||||
.sp
|
.sp
|
||||||
Outputs timings, including database setup and total run time.
|
Outputs timings, including database setup and total run time.
|
||||||
|
.INDENT 0.0
|
||||||
|
.TP
|
||||||
|
.B \-\-durations N
|
||||||
|
.UNINDENT
|
||||||
|
.sp
|
||||||
|
|
||||||
|
.sp
|
||||||
|
Shows the N slowest test cases (N=0 for all).
|
||||||
|
.INDENT 0.0
|
||||||
|
.INDENT 3.5
|
||||||
|
.IP "Python 3.12 and later"
|
||||||
|
.sp
|
||||||
|
This feature is only available for Python 3.12 and later.
|
||||||
|
.UNINDENT
|
||||||
|
.UNINDENT
|
||||||
.SS \fBtestserver\fP
|
.SS \fBtestserver\fP
|
||||||
.INDENT 0.0
|
.INDENT 0.0
|
||||||
.TP
|
.TP
|
||||||
@ -2097,7 +2120,7 @@ When you\(aqre writing \fI\%unit tests\fP 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
|
||||||
Let\(aqs say you\(aqre developing your Django application and have a "pristine"
|
Let\(aqs say you\(aqre developing your Django application and have a \(dqpristine\(dq
|
||||||
copy of a database that you\(aqd 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 \fI\%fixture\fP (using the
|
database to a \fI\%fixture\fP (using the
|
||||||
\fI\%dumpdata\fP command, explained above), then use \fBtestserver\fP to run
|
\fI\%dumpdata\fP command, explained above), then use \fBtestserver\fP to run
|
||||||
@ -2297,13 +2320,6 @@ documentation.
|
|||||||
.UNINDENT
|
.UNINDENT
|
||||||
.sp
|
.sp
|
||||||
Can be run as a cron job or directly to clean out expired sessions.
|
Can be run as a cron job or directly to clean out expired sessions.
|
||||||
.SS \fBdjango.contrib.sitemaps\fP
|
|
||||||
.SS \fBping_google\fP
|
|
||||||
.sp
|
|
||||||
This command is only available if the \fI\%Sitemaps framework\fP (\fBdjango.contrib.sitemaps\fP) is installed.
|
|
||||||
.sp
|
|
||||||
Please refer to its \fI\%description\fP in the Sitemaps
|
|
||||||
documentation.
|
|
||||||
.SS \fBdjango.contrib.staticfiles\fP
|
.SS \fBdjango.contrib.staticfiles\fP
|
||||||
.SS \fBcollectstatic\fP
|
.SS \fBcollectstatic\fP
|
||||||
.sp
|
.sp
|
||||||
@ -2491,16 +2507,16 @@ escape sequences so by default there is no color output. In this case either of
|
|||||||
two third\-party libraries are needed:
|
two third\-party libraries are needed:
|
||||||
.INDENT 0.0
|
.INDENT 0.0
|
||||||
.IP \(bu 2
|
.IP \(bu 2
|
||||||
Install \fI\%colorama\fP, a Python package that translates ANSI color codes into
|
Install \fI\%colorama\fP, a Python package that translates ANSI color codes
|
||||||
Windows API calls. Django commands will detect its presence and will make use
|
into Windows API calls. Django commands will detect its presence and will
|
||||||
of its services to color output just like on Unix\-based platforms.
|
make use of its services to color output just like on Unix\-based platforms.
|
||||||
\fBcolorama\fP can be installed via pip:
|
\fBcolorama\fP can be installed via pip:
|
||||||
.INDENT 2.0
|
.INDENT 2.0
|
||||||
.INDENT 3.5
|
.INDENT 3.5
|
||||||
.sp
|
.sp
|
||||||
.nf
|
.nf
|
||||||
.ft C
|
.ft C
|
||||||
\&...\e> py \-m pip install colorama
|
\&...\e> py \-m pip install \(dqcolorama >= 0.4.6\(dq
|
||||||
.ft P
|
.ft P
|
||||||
.fi
|
.fi
|
||||||
.UNINDENT
|
.UNINDENT
|
||||||
@ -2512,9 +2528,9 @@ of its services to color output just like on Unix\-based platforms.
|
|||||||
.UNINDENT
|
.UNINDENT
|
||||||
.sp
|
.sp
|
||||||
Other modern terminal environments on Windows, that support terminal colors,
|
Other modern terminal environments on Windows, that support terminal colors,
|
||||||
but which are not automatically detected as supported by Django, may "fake" the
|
but which are not automatically detected as supported by Django, may \(dqfake\(dq the
|
||||||
installation of \fBANSICON\fP by setting the appropriate environmental variable,
|
installation of \fBANSICON\fP by setting the appropriate environmental variable,
|
||||||
\fBANSICON="on"\fP\&.
|
\fBANSICON=\(dqon\(dq\fP\&.
|
||||||
.SS Custom colors
|
.SS Custom colors
|
||||||
.sp
|
.sp
|
||||||
The colors used for syntax highlighting can be customized. Django
|
The colors used for syntax highlighting can be customized. Django
|
||||||
@ -2539,7 +2555,7 @@ would run the following at a command prompt:
|
|||||||
.sp
|
.sp
|
||||||
.nf
|
.nf
|
||||||
.ft C
|
.ft C
|
||||||
export DJANGO_COLORS="light"
|
export DJANGO_COLORS=\(dqlight\(dq
|
||||||
.ft P
|
.ft P
|
||||||
.fi
|
.fi
|
||||||
.UNINDENT
|
.UNINDENT
|
||||||
@ -2641,7 +2657,7 @@ are then separated by a semicolon. For example:
|
|||||||
.sp
|
.sp
|
||||||
.nf
|
.nf
|
||||||
.ft C
|
.ft C
|
||||||
export DJANGO_COLORS="error=yellow/blue,blink;notice=magenta"
|
export DJANGO_COLORS=\(dqerror=yellow/blue,blink;notice=magenta\(dq
|
||||||
.ft P
|
.ft P
|
||||||
.fi
|
.fi
|
||||||
.UNINDENT
|
.UNINDENT
|
||||||
@ -2659,7 +2675,7 @@ palette will be loaded. So:
|
|||||||
.sp
|
.sp
|
||||||
.nf
|
.nf
|
||||||
.ft C
|
.ft C
|
||||||
export DJANGO_COLORS="light;error=yellow/blue,blink;notice=magenta"
|
export DJANGO_COLORS=\(dqlight;error=yellow/blue,blink;notice=magenta\(dq
|
||||||
.ft P
|
.ft P
|
||||||
.fi
|
.fi
|
||||||
.UNINDENT
|
.UNINDENT
|
||||||
@ -2686,8 +2702,6 @@ with \fBsql\fP\&.
|
|||||||
.sp
|
.sp
|
||||||
See \fI\%How to create custom django\-admin commands\fP for how to add customized actions.
|
See \fI\%How to create custom django\-admin commands\fP for how to add customized actions.
|
||||||
.SS Black formatting
|
.SS Black formatting
|
||||||
.sp
|
|
||||||
|
|
||||||
.sp
|
.sp
|
||||||
The Python files created by \fI\%startproject\fP, \fI\%startapp\fP,
|
The Python files created by \fI\%startproject\fP, \fI\%startapp\fP,
|
||||||
\fI\%optimizemigration\fP, \fI\%makemigrations\fP, and
|
\fI\%optimizemigration\fP, \fI\%makemigrations\fP, and
|
||||||
@ -2723,7 +2737,7 @@ django\-admin inspectdb | black \-
|
|||||||
.B django.core.management.call_command(name, *args, **options)
|
.B django.core.management.call_command(name, *args, **options)
|
||||||
.UNINDENT
|
.UNINDENT
|
||||||
.sp
|
.sp
|
||||||
To call a management command from code use \fBcall_command\fP\&.
|
To call a management command from code use \fBcall_command()\fP\&.
|
||||||
.INDENT 0.0
|
.INDENT 0.0
|
||||||
.TP
|
.TP
|
||||||
.B \fBname\fP
|
.B \fBname\fP
|
||||||
@ -2751,9 +2765,9 @@ Examples:
|
|||||||
from django.core import management
|
from django.core import management
|
||||||
from django.core.management.commands import loaddata
|
from django.core.management.commands import loaddata
|
||||||
|
|
||||||
management.call_command(\(aqflush\(aq, verbosity=0, interactive=False)
|
management.call_command(\(dqflush\(dq, verbosity=0, interactive=False)
|
||||||
management.call_command(\(aqloaddata\(aq, \(aqtest_data\(aq, verbosity=0)
|
management.call_command(\(dqloaddata\(dq, \(dqtest_data\(dq, verbosity=0)
|
||||||
management.call_command(loaddata.Command(), \(aqtest_data\(aq, verbosity=0)
|
management.call_command(loaddata.Command(), \(dqtest_data\(dq, verbosity=0)
|
||||||
.ft P
|
.ft P
|
||||||
.fi
|
.fi
|
||||||
.UNINDENT
|
.UNINDENT
|
||||||
@ -2769,14 +2783,14 @@ Named arguments can be passed by using either one of the following syntaxes:
|
|||||||
.nf
|
.nf
|
||||||
.ft C
|
.ft C
|
||||||
# Similar to the command line
|
# Similar to the command line
|
||||||
management.call_command(\(aqdumpdata\(aq, \(aq\-\-natural\-foreign\(aq)
|
management.call_command(\(dqdumpdata\(dq, \(dq\-\-natural\-foreign\(dq)
|
||||||
|
|
||||||
# Named argument similar to the command line minus the initial dashes and
|
# Named argument similar to the command line minus the initial dashes and
|
||||||
# with internal dashes replaced by underscores
|
# with internal dashes replaced by underscores
|
||||||
management.call_command(\(aqdumpdata\(aq, natural_foreign=True)
|
management.call_command(\(dqdumpdata\(dq, natural_foreign=True)
|
||||||
|
|
||||||
# \(gause_natural_foreign_keys\(ga is the option destination variable
|
# \(gause_natural_foreign_keys\(ga is the option destination variable
|
||||||
management.call_command(\(aqdumpdata\(aq, use_natural_foreign_keys=True)
|
management.call_command(\(dqdumpdata\(dq, use_natural_foreign_keys=True)
|
||||||
.ft P
|
.ft P
|
||||||
.fi
|
.fi
|
||||||
.UNINDENT
|
.UNINDENT
|
||||||
@ -2795,7 +2809,7 @@ Command options which take multiple options are passed a list:
|
|||||||
.sp
|
.sp
|
||||||
.nf
|
.nf
|
||||||
.ft C
|
.ft C
|
||||||
management.call_command(\(aqdumpdata\(aq, exclude=[\(aqcontenttypes\(aq, \(aqauth\(aq])
|
management.call_command(\(dqdumpdata\(dq, exclude=[\(dqcontenttypes\(dq, \(dqauth\(dq])
|
||||||
.ft P
|
.ft P
|
||||||
.fi
|
.fi
|
||||||
.UNINDENT
|
.UNINDENT
|
||||||
@ -2812,8 +2826,8 @@ support the \fBstdout\fP and \fBstderr\fP options. For example, you could write:
|
|||||||
.sp
|
.sp
|
||||||
.nf
|
.nf
|
||||||
.ft C
|
.ft C
|
||||||
with open(\(aq/path/to/command_output\(aq, \(aqw\(aq) as f:
|
with open(\(dq/path/to/command_output\(dq, \(dqw\(dq) as f:
|
||||||
management.call_command(\(aqdumpdata\(aq, stdout=f)
|
management.call_command(\(dqdumpdata\(dq, stdout=f)
|
||||||
.ft P
|
.ft P
|
||||||
.fi
|
.fi
|
||||||
.UNINDENT
|
.UNINDENT
|
||||||
|
Loading…
Reference in New Issue
Block a user