diff options
| author | Tim Graham <timograham@gmail.com> | 2016-01-11 20:59:34 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-01-14 18:21:33 -0500 |
| commit | e519aab43a419589e92fe284e4ce2f2e034aec6a (patch) | |
| tree | e1af3c01ca87ff9b639ac45ec97ac9869d273c43 /docs/ref | |
| parent | fd1c5bb041abb617dc58c336a8461fb3a7af4508 (diff) | |
Fixed #23868 -- Added support for non-unique django-admin-options in docs.
Also documented missing short command line options to fix #24134. This bumps
the minimum sphinx version required to build the docs to 1.3.4.
Thanks Simon Charette for review.
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/checks.txt | 5 | ||||
| -rw-r--r-- | docs/ref/contrib/contenttypes.txt | 3 | ||||
| -rw-r--r-- | docs/ref/contrib/gis/commands.txt | 20 | ||||
| -rw-r--r-- | docs/ref/contrib/sitemaps.txt | 2 | ||||
| -rw-r--r-- | docs/ref/contrib/staticfiles.txt | 35 | ||||
| -rw-r--r-- | docs/ref/django-admin.txt | 825 | ||||
| -rw-r--r-- | docs/ref/settings.txt | 4 | ||||
| -rw-r--r-- | docs/ref/signals.txt | 4 |
8 files changed, 436 insertions, 462 deletions
diff --git a/docs/ref/checks.txt b/docs/ref/checks.txt index cf93a61c79..e9c8e45cbb 100644 --- a/docs/ref/checks.txt +++ b/docs/ref/checks.txt @@ -69,6 +69,8 @@ class name. Builtin checks ============== +.. _system-check-builtin-tags: + Builtin tags ------------ @@ -449,8 +451,7 @@ balancer, it'd be irritating to be constantly warned about not having enabled :setting:`SECURE_SSL_REDIRECT`. Use :setting:`SILENCED_SYSTEM_CHECKS` to silence unneeded checks. -The following checks will be run if you use the :djadminopt:`--deploy` option -of the :djadmin:`check` command: +The following checks are run if you use the :option:`check --deploy` option: * **security.W001**: You do not have :class:`django.middleware.security.SecurityMiddleware` in your diff --git a/docs/ref/contrib/contenttypes.txt b/docs/ref/contrib/contenttypes.txt index 0d75739e48..343ede1949 100644 --- a/docs/ref/contrib/contenttypes.txt +++ b/docs/ref/contrib/contenttypes.txt @@ -320,8 +320,7 @@ model: generic relations, you should probably be using a natural key to uniquely identify related :class:`~django.contrib.contenttypes.models.ContentType` objects. See :ref:`natural keys<topics-serialization-natural-keys>` and - :djadminopt:`dumpdata --natural-foreign <--natural-foreign>` for more - information. + :option:`dumpdata --natural-foreign` for more information. This will enable an API similar to the one used for a normal :class:`~django.db.models.ForeignKey`; diff --git a/docs/ref/contrib/gis/commands.txt b/docs/ref/contrib/gis/commands.txt index d22621aafe..71f3863f4b 100644 --- a/docs/ref/contrib/gis/commands.txt +++ b/docs/ref/contrib/gis/commands.txt @@ -12,35 +12,35 @@ When :mod:`django.contrib.gis` is in your :setting:`INSTALLED_APPS`, the The overridden command is spatially-aware, and places geometry fields in the auto-generated model definition, where appropriate. -ogrinspect <data_source> <model_name> -===================================== +ogrinspect +========== -.. django-admin:: ogrinspect +.. django-admin:: ogrinspect data_source model_name The ``ogrinspect`` management command will inspect the given OGR-compatible :class:`~django.contrib.gis.gdal.DataSource` (e.g., a shapefile) and will output a GeoDjango model with the given model name. There's a detailed example of using ``ogrinspect`` :ref:`in the tutorial <ogrinspect-intro>`. -.. django-admin-option:: --blank <blank_field(s)> +.. django-admin-option:: --blank BLANK Use a comma separated list of OGR field names to add the ``blank=True`` keyword option to the field definition. Set with ``true`` to apply to all applicable fields. -.. django-admin-option:: --decimal <decimal_field(s)> +.. django-admin-option:: --decimal DECIMAL Use a comma separated list of OGR float fields to generate :class:`~django.db.models.DecimalField` instead of the default :class:`~django.db.models.FloatField`. Set to ``true`` to apply to all OGR float fields. -.. django-admin-option:: --geom-name <name> +.. django-admin-option:: --geom-name GEOM_NAME Specifies the model attribute name to use for the geometry field. Defaults to ``'geom'``. -.. django-admin-option:: --layer <layer> +.. django-admin-option:: --layer LAYER_KEY The key for specifying which layer in the OGR :class:`~django.contrib.gis.gdal.DataSource` source to use. @@ -61,7 +61,7 @@ of using ``ogrinspect`` :ref:`in the tutorial <ogrinspect-intro>`. in the generated model rather than :class:`~django.contrib.gis.db.models.PolygonField`. -.. django-admin-option:: --name-field <name_field> +.. django-admin-option:: --name-field NAME_FIELD Generates a ``__str__`` routine (``__unicode__`` on Python 2) on the model that will return the given field name. @@ -70,13 +70,13 @@ of using ``ogrinspect`` :ref:`in the tutorial <ogrinspect-intro>`. Suppresses the ``from django.contrib.gis.db import models`` import statement. -.. django-admin-option:: --null <null_field(s)> +.. django-admin-option:: --null NULL Use a comma separated list of OGR field names to add the ``null=True`` keyword option to the field definition. Set with ``true`` to apply to all applicable fields. -.. django-admin-option:: --srid +.. django-admin-option:: --srid SRID The SRID to use for the geometry field. If not set, ``ogrinspect`` attempts to automatically determine of the SRID of the data source. diff --git a/docs/ref/contrib/sitemaps.txt b/docs/ref/contrib/sitemaps.txt index 822b338e2e..58c5e71a31 100644 --- a/docs/ref/contrib/sitemaps.txt +++ b/docs/ref/contrib/sitemaps.txt @@ -519,7 +519,7 @@ each time you call ``save()``. Pinging Google via ``manage.py`` -------------------------------- -.. django-admin:: ping_google +.. django-admin:: ping_google [sitemap_url] Once the sitemaps application is added to your project, you may also ping Google using the ``ping_google`` management command:: diff --git a/docs/ref/contrib/staticfiles.txt b/docs/ref/contrib/staticfiles.txt index e6caa53e32..b6da4b98d2 100644 --- a/docs/ref/contrib/staticfiles.txt +++ b/docs/ref/contrib/staticfiles.txt @@ -49,8 +49,8 @@ can help show you which files are found. On subsequent ``collectstatic`` runs (if ``STATIC_ROOT`` isn't empty), files are copied only if they have a modified timestamp greater than the timestamp of the file in ``STATIC_ROOT``. Therefore if you remove an application from -:setting:`INSTALLED_APPS`, it's a good idea to use the :djadminopt:`--clear` -option in order to remove stale static files. +:setting:`INSTALLED_APPS`, it's a good idea to use the :option:`collectstatic +--clear` option in order to remove stale static files. Files are searched by using the :setting:`enabled finders <STATICFILES_FINDERS>`. The default is to look in all locations defined in @@ -88,33 +88,28 @@ Then set the :setting:`STATICFILES_STORAGE` setting to Some commonly used options are: -.. django-admin-option:: --noinput +.. django-admin-option:: --noinput, --no-input - Do NOT prompt the user for input of any kind. You can use ``--no-input`` - as an alias for this option. + Do NOT prompt the user for input of any kind. .. versionchanged:: 1.9 The ``--no-input`` alias was added. -.. django-admin-option:: -i <pattern> -.. django-admin-option:: --ignore <pattern> +.. django-admin-option:: --ignore PATTERN, -i PATTERN Ignore files or directories matching this glob-style pattern. Use multiple times to ignore more. -.. django-admin-option:: -n -.. django-admin-option:: --dry-run +.. django-admin-option:: --dry-run, -n Do everything except modify the filesystem. -.. django-admin-option:: -c -.. django-admin-option:: --clear +.. django-admin-option:: --clear, -c Clear the existing files before trying to copy or link the original file. -.. django-admin-option:: -l -.. django-admin-option:: --link +.. django-admin-option:: --link, -l Create a symbolic link to each file instead of copying. @@ -136,7 +131,7 @@ For a full list of options, refer to the commands own help by running:: findstatic ---------- -.. django-admin:: findstatic +.. django-admin:: findstatic static file [static file ...] Searches for one or more relative paths with the enabled finders. @@ -149,6 +144,8 @@ For example:: Found 'admin/js/core.js' here: /home/polls.com/src/django/contrib/admin/media/js/core.js +.. django-admin-option:: findstatic --first + By default, all matching locations are found. To only return the first match for each relative path, use the ``--first`` option:: @@ -159,15 +156,15 @@ for each relative path, use the ``--first`` option:: This is a debugging aid; it'll show you exactly which static file will be collected for a given path. -By setting the :djadminopt:`--verbosity` flag to 0, you can suppress the extra -output and just get the path names:: +By setting the ``--verbosity`` flag to 0, you can suppress the extra output and +just get the path names:: $ python manage.py findstatic css/base.css --verbosity 0 /home/special.polls.com/core/static/css/base.css /home/polls.com/core/static/css/base.css -On the other hand, by setting the :djadminopt:`--verbosity` flag to 2, you can -get all the directories which were searched:: +On the other hand, by setting the ``--verbosity`` flag to 2, you can get all +the directories which were searched:: $ python manage.py findstatic css/base.css --verbosity 2 Found 'css/base.css' here: @@ -183,7 +180,7 @@ get all the directories which were searched:: runserver --------- -.. django-admin:: runserver +.. django-admin:: runserver [addrport] Overrides the core :djadmin:`runserver` command if the ``staticfiles`` app is :setting:`installed<INSTALLED_APPS>` and adds automatic serving of static diff --git a/docs/ref/django-admin.txt b/docs/ref/django-admin.txt index 80e40485db..a0d9e54296 100644 --- a/docs/ref/django-admin.txt +++ b/docs/ref/django-admin.txt @@ -27,7 +27,7 @@ Environment...``) to point to its installed location. Generally, when working on a single Django project, it's easier to use ``manage.py`` than ``django-admin``. If you need to switch between multiple Django settings files, use ``django-admin`` with -:envvar:`DJANGO_SETTINGS_MODULE` or the :djadminopt:`--settings` command line +:envvar:`DJANGO_SETTINGS_MODULE` or the :option:`--settings` command line option. The command-line examples throughout this document use ``django-admin`` to @@ -88,50 +88,45 @@ The output follows the schema described in :pep:`440`:: Displaying debug output ----------------------- -Use :djadminopt:`--verbosity` to specify the amount of notification and debug information -that ``django-admin`` should print to the console. For more details, see the -documentation for the :djadminopt:`--verbosity` option. +.. program:: None + +Use :option:`--verbosity` to specify the amount of notification and debug +information that ``django-admin`` prints to the console. Available commands ================== -check <appname appname ...> ---------------------------- - -.. django-admin:: check +check +----- -Uses the :doc:`system check framework </ref/checks>` to inspect -the entire Django project for common problems. +.. django-admin:: check [app_label [app_label ...]] -The system check framework will confirm that there aren't any problems with -your installed models or your admin registrations. It will also provide warnings -of common compatibility problems introduced by upgrading Django to a new version. -Custom checks may be introduced by other libraries and applications. +Uses the :doc:`system check framework </ref/checks>` to inspect the entire +Django project for common problems. -By default, all apps will be checked. You can check a subset of apps by providing -a list of app labels as arguments:: +By default, all apps will be checked. You can check a subset of apps by +providing a list of app labels as arguments:: - python manage.py check auth admin myapp + django-admin check auth admin myapp If you do not specify any app, all apps will be checked. -.. django-admin-option:: --tag <tagname> +.. django-admin-option:: --tag TAGS, -t TAGS -The :doc:`system check framework </ref/checks>` performs many different -types of checks. These check types are categorized with tags. You can use these tags -to restrict the checks performed to just those in a particular category. For example, -to perform only security and compatibility checks, you would run:: +The system check framework performs many different types of checks that are +:ref:`categorized with tags <system-check-builtin-tags>`. You can use these +tags to restrict the checks performed to just those in a particular category. +For example, to perform only models and compatibility checks, run:: - python manage.py check --tag security --tag compatibility + django-admin check --tag models --tag compatibility .. django-admin-option:: --list-tags -List all available tags. +Lists all available tags. .. django-admin-option:: --deploy -The ``--deploy`` option activates some additional checks that are only relevant -in a deployment setting. +Activates some additional checks that are only relevant in a deployment setting. You can use this option in your local development environment, but since your local development settings module may not have many of your production settings, @@ -139,39 +134,39 @@ you will probably want to point the ``check`` command at a different settings module, either by setting the ``DJANGO_SETTINGS_MODULE`` environment variable, or by passing the ``--settings`` option:: - python manage.py check --deploy --settings=production_settings + django-admin check --deploy --settings=production_settings Or you could run it directly on a production or staging deployment to verify that the correct settings are in use (omitting ``--settings``). You could even make it part of your integration test suite. -.. django-admin-option:: --fail-level +.. django-admin-option:: --fail-level {CRITICAL,ERROR,WARNING,INFO,DEBUG} .. versionadded:: 1.10 Specifies the message level that will cause the command to exit with a non-zero status. Default is ``ERROR``. -Available levels are: ``CRITICAL``, ``ERROR``, ``WARNING``, ``INFO``, and -``DEBUG``. - compilemessages --------------- .. django-admin:: compilemessages -Compiles .po files created by :djadmin:`makemessages` to .mo files for use with -the builtin gettext support. See :doc:`/topics/i18n/index`. +Compiles ``.po`` files created by :djadmin:`makemessages` to ``.mo`` files for +use with the built-in gettext support. See :doc:`/topics/i18n/index`. -Use the :djadminopt:`--locale` option (or its shorter version ``-l``) to -specify the locale(s) to process. If not provided, all locales are processed. +.. django-admin-option:: --locale LOCALE, -l LOCALE -Use the :djadminopt:`--exclude` option (or its shorter version ``-x``) to -specify the locale(s) to exclude from processing. If not provided, no locales +Specifies the locale(s) to process. If not provided, all locales are processed. + +.. django-admin-option:: --exclude EXCLUDE, -x EXCLUDE + +Specifies the locale(s) to exclude from processing. If not provided, no locales are excluded. -You can pass ``--use-fuzzy`` option (or ``-f``) to include fuzzy translations -into compiled files. +.. django-admin-option:: --use-fuzzy, -f + +Includes fuzzy translations into compiled files. .. versionchanged:: 1.9 @@ -198,12 +193,15 @@ Creates the cache tables for use with the database cache backend using the information from your settings file. See :doc:`/topics/cache` for more information. -The :djadminopt:`--database` option can be used to specify the database -onto which the cache table will be installed, but since this information is -pulled from your settings by default, it's typically not needed. +.. django-admin-option:: --database DATABASE -The :djadminopt:`--dry-run` option will print the SQL that would be run without -actually running it, so you can customize it or use the migrations framework. +Specifies the database in which the cache table(s) will be created. Defaults to +``default``. + +.. django-admin-option:: --dry-run + +Prints the SQL that would be run without actually running it, so you can +customize it or use the migrations framework. .. versionchanged:: 1.9 @@ -215,8 +213,8 @@ dbshell .. django-admin:: dbshell Runs the command-line client for the database engine specified in your -``ENGINE`` setting, with the connection parameters specified in your -:setting:`USER`, :setting:`PASSWORD`, etc., settings. +:setting:`ENGINE <DATABASE-ENGINE>` setting, with the connection parameters +specified in your :setting:`USER`, :setting:`PASSWORD`, etc., settings. * For PostgreSQL, this runs the ``psql`` command-line client. * For MySQL, this runs the ``mysql`` command-line client. @@ -228,8 +226,9 @@ the program name (``psql``, ``mysql``, ``sqlite3``, ``sqlplus``) will find the program in the right place. There's no way to specify the location of the program manually. -The :djadminopt:`--database` option can be used to specify the database -onto which to open a shell. +.. django-admin-option:: --database DATABASE + +Specifies the database onto which to open a shell. Defaults to ``default``. diffsettings ------------ @@ -244,13 +243,15 @@ example, the default settings don't define :setting:`ROOT_URLCONF`, so :setting:`ROOT_URLCONF` is followed by ``"###"`` in the output of ``diffsettings``. -The :djadminopt:`--all` option may be provided to display all settings, even -if they have Django's default value. Such settings are prefixed by ``"###"``. +.. django-admin-option:: --all -dumpdata <app_label app_label app_label.Model ...> --------------------------------------------------- +Displays all settings, even if they have Django's default value. Such settings +are prefixed by ``"###"``. + +dumpdata +-------- -.. django-admin:: dumpdata +.. django-admin:: dumpdata [app_label[.ModelName] [app_label[.ModelName] ...]] Outputs to standard output all data in the database associated with the named application(s). @@ -264,59 +265,63 @@ records to dump. If you're using a :ref:`custom manager <custom-managers>` as the default manager and it filters some of the available records, not all of the objects will be dumped. -The :djadminopt:`--all` option may be provided to specify that -``dumpdata`` should use Django's base manager, dumping records which -might otherwise be filtered or modified by a custom manager. +.. django-admin-option:: --all, -a -.. django-admin-option:: --format <fmt> +Uses Django's base manager, dumping records which might otherwise be filtered +or modified by a custom manager. -By default, ``dumpdata`` will format its output in JSON, but you can use the -``--format`` option to specify another format. Currently supported formats -are listed in :ref:`serialization-formats`. +.. django-admin-option:: --format FORMAT -.. django-admin-option:: --indent <num> +Specifies the serialization format of the output. Defaults to JSON. Supported +formats are listed in :ref:`serialization-formats`. -By default, ``dumpdata`` will output all data on a single line. This isn't -easy for humans to read, so you can use the ``--indent`` option to -pretty-print the output with a number of indentation spaces. +.. django-admin-option:: --indent INDENT -The :djadminopt:`--exclude` option may be provided to prevent specific -applications or models (specified as in the form of ``app_label.ModelName``) -from being dumped. If you specify a model name to ``dumpdata``, the dumped +Specifies the number of indentation spaces to use in the output. Defaults to +``None`` which displays all data on single line. + +.. django-admin-option:: --exclude EXCLUDE, -e EXCLUDE + +Prevents specific applications or models (specified in the form of +``app_label.ModelName``) from being dumped. If you specify a model name, the output will be restricted to that model, rather than the entire application. You can also mix application names and model names. -The :djadminopt:`--database` option can be used to specify the database -from which data will be dumped. +If you want to exclude multiple applications, pass ``--exclude`` more than +once:: + + django-admin dumpdata --exclude=auth --exclude=contenttypes + +.. django-admin-option:: --database DATABASE + +Specifies the database from which data will be dumped. Defaults to ``default``. .. django-admin-option:: --natural-foreign -When this option is specified, Django will use the ``natural_key()`` model -method to serialize any foreign key and many-to-many relationship to objects of -the type that defines the method. If you are dumping ``contrib.auth`` -``Permission`` objects or ``contrib.contenttypes`` ``ContentType`` objects, you -should probably be using this flag. See the :ref:`natural keys -<topics-serialization-natural-keys>` documentation for more details on this -and the next option. +Uses the ``natural_key()`` 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 ``contrib.auth`` ``Permission`` objects or +``contrib.contenttypes`` ``ContentType`` objects, you should probably use this +flag. See the :ref:`natural keys <topics-serialization-natural-keys>` +documentation for more details on this and the next option. .. django-admin-option:: --natural-primary -When this option is specified, Django will not provide the primary key in the -serialized data of this object since it can be calculated during -deserialization. +Omits the primary key in the serialized data of this object since it can be +calculated during deserialization. + +.. django-admin-option:: --pks PRIMARY_KEYS -.. django-admin-option:: --pks +Outputs only the objects specified by a comma separated list of primary keys. +This is only available when dumping one model. By default, all the records of +the model are output. -By default, ``dumpdata`` will output all the records of the model, but -you can use the ``--pks`` option to specify a comma separated list of -primary keys on which to filter. This is only available when dumping -one model. +.. django-admin-option:: --output OUTPUT, -o OUTPUT -.. django-admin-option:: --output +Specifies a file to write the serialized data to. By default, the data goes to +standard output. -By default ``dumpdata`` will output all the serialized data to standard output. -This option allows you to specify the file to which the data is to be written. -When this option is set and the verbosity is greater than 0 (the default), a +When this option is set and ``--verbosity`` is greater than 0 (the default), a progress bar is shown in the terminal. .. versionchanged:: 1.9 @@ -334,11 +339,17 @@ handlers. The table of which migrations have been applied is not cleared. If you would rather start from an empty database and re-run all migrations, you should drop and recreate the database and then run :djadmin:`migrate` instead. -The :djadminopt:`--noinput` option may be provided to suppress all user -prompts. +.. django-admin-option:: --noinput, --no-input + +Suppresses all user prompts. + +.. versionchanged:: 1.9 + + The ``--no-input`` alias was added. -The :djadminopt:`--database` option may be used to specify the database -to flush. +.. django-admin-option:: --database DATABASE + +Specifies the database to flush. Defaults to ``default``. inspectdb --------- @@ -395,28 +406,30 @@ table's lifecycle, you'll need to change the :attr:`~django.db.models.Options.managed` option to ``True`` (or simply remove it because ``True`` is its default value). -The :djadminopt:`--database` option may be used to specify the -database to introspect. +.. django-admin-option:: --database DATABASE -loaddata <fixture fixture ...> ------------------------------- +Specifies the database to introspect. Defaults to ``default``. -.. django-admin:: loaddata +loaddata +-------- + +.. django-admin:: loaddata fixture [fixture ...] Searches for and loads the contents of the named fixture into the database. -The :djadminopt:`--database` option can be used to specify the database -onto which the data will be loaded. +.. django-admin-option:: --database DATABASE + +Specifies the database into which the data will be loaded. Defaults to +``default``. -.. django-admin-option:: --ignorenonexistent +.. django-admin-option:: --ignorenonexistent, -i -The :djadminopt:`--ignorenonexistent` option can be used to ignore fields and -models that may have been removed since the fixture was originally generated. +Ignores fields and models that may have been removed since the fixture was +originally generated. -.. django-admin-option:: --app +.. django-admin-option:: --app APP_LABEL -The :djadminopt:`--app` option can be used to specify a single app to look -for fixtures in rather than looking through all apps. +Specifies a single app to look for fixtures in rather than looking in all apps. What's a "fixture"? ~~~~~~~~~~~~~~~~~~~ @@ -558,33 +571,31 @@ directory. After making changes to the messages files you need to compile them with :djadmin:`compilemessages` for use with the builtin gettext support. See the :ref:`i18n documentation <how-to-create-language-files>` for details. -.. django-admin-option:: --all +.. django-admin-option:: --all, -a -Use the ``--all`` or ``-a`` option to update the message files for all -available languages. +Updates the message files for all available languages. -Example usage:: +.. django-admin-option:: --extension EXTENSIONS, -e EXTENSIONS - django-admin makemessages --all - -.. django-admin-option:: --extension - -Use the ``--extension`` or ``-e`` option to specify a list of file extensions -to examine (default: ".html", ".txt"). +Specifies a list of file extensions to examine (default: ``html``, ``txt``, +``py`` or ``js`` if :option:`--domain` is ``js``). Example usage:: django-admin makemessages --locale=de --extension xhtml -Separate multiple extensions with commas or use -e or --extension multiple times:: +Separate multiple extensions with commas or use ``-e`` or ``--extension`` +multiple times:: django-admin makemessages --locale=de --extension=html,txt --extension xml -Use the :djadminopt:`--locale` option (or its shorter version ``-l``) to -specify the locale(s) to process. +.. django-admin-option:: --locale LOCALE, -l LOCALE + +Specifies the locale(s) to process. + +.. django-admin-option:: --exclude EXCLUDE, -x EXCLUDE -Use the :djadminopt:`--exclude` option (or its shorter version ``-x``) to -specify the locale(s) to exclude from processing. If not provided, no locales +Specifies the locale(s) to exclude from processing. If not provided, no locales are excluded. Example usage:: @@ -598,29 +609,27 @@ Example usage:: django-admin makemessages -x pt_BR django-admin makemessages -x pt_BR -x fr -.. django-admin-option:: --domain +.. django-admin-option:: --domain DOMAIN, -d DOMAIN -Use the ``--domain`` or ``-d`` option to change the domain of the messages files. -Currently supported: +Specifies the domain of the messages files. Supported options are: * ``django`` for all ``*.py``, ``*.html`` and ``*.txt`` files (default) * ``djangojs`` for ``*.js`` files -.. django-admin-option:: --symlinks +.. django-admin-option:: --symlinks, -s -Use the ``--symlinks`` or ``-s`` option to follow symlinks to directories when -looking for new translation strings. +Follows symlinks to directories when looking for new translation strings. Example usage:: django-admin makemessages --locale=de --symlinks -.. django-admin-option:: --ignore +.. django-admin-option:: --ignore PATTERN, -i PATTERN -Use the ``--ignore`` or ``-i`` option to ignore files or directories matching -the given :mod:`glob`-style pattern. Use multiple times to ignore more. +Ignores files or directories matching the given :mod:`glob`-style pattern. Use +multiple times to ignore more. -These patterns are used by default: ``'CVS'``, ``'.*'``, ``'*~'``, ``'*.pyc'`` +These patterns are used by default: ``'CVS'``, ``'.*'``, ``'*~'``, ``'*.pyc'``. Example usage:: @@ -628,35 +637,33 @@ Example usage:: .. django-admin-option:: --no-default-ignore -Use the ``--no-default-ignore`` option to disable the default values of -:djadminopt:`--ignore`. +Disables the default values of ``--ignore``. .. django-admin-option:: --no-wrap -Use the ``--no-wrap`` option to disable breaking long message lines into -several lines in language files. +Disables breaking long message lines into several lines in language files. .. django-admin-option:: --no-location -Use the ``--no-location`` option to suppress writing '``#: filename:line``’ -comment lines in language files. Note that using this option makes it harder -for technically skilled translators to understand each message's context. +Suppresses writing '``#: filename:line``’ comment lines in language files. +Using this option makes it harder for technically skilled translators to +understand each message's context. .. django-admin-option:: --keep-pot -Use the ``--keep-pot`` option to prevent Django from deleting the temporary -``.pot`` files it generates before creating the .po file. This is useful for -debugging errors which may prevent the final language files from being created. +Prevents deleting the temporary ``.pot`` files generated before creating the +``.po`` file. This is useful for debugging errors which may prevent the final +language files from being created. .. seealso:: See :ref:`customizing-makemessages` for instructions on how to customize the keywords that :djadmin:`makemessages` passes to ``xgettext``. -makemigrations [<app_label>] ----------------------------- +makemigrations +-------------- -.. django-admin:: makemigrations +.. django-admin:: makemigrations [app_label [app_label ...]] Creates new migrations based on the changes detected to your models. Migrations, their relationship with apps and more are covered in depth in @@ -666,56 +673,56 @@ 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 ``ForeignKey``, for example). +.. django-admin-option:: --noinput, --no-input + +Suppresses all user prompts. If a suppressed prompt cannot be resolved +automatically, the command will exit with error code 3. + .. versionchanged:: 1.9 -The ``--noinput`` option may be provided to suppress all user prompts. If a suppressed -prompt cannot be resolved automatically, the command will exit with error code 3. + The ``--no-input`` alias was added. .. django-admin-option:: --empty -The ``--empty`` option will cause ``makemigrations`` to output an empty -migration for the specified apps, for manual editing. This option is only -for advanced users and should not be used unless you are familiar with -the migration format, migration operations, and the dependencies between -your migrations. +Outputs an empty migration for the specified apps, for manual editing. This is +for advanced users and should not be used unless you are familiar with the +migration format, migration operations, and the dependencies between your +migrations. .. django-admin-option:: --dry-run -The ``--dry-run`` option shows what migrations would be made without -actually writing any migrations files to disk. Using this option along with -``--verbosity 3`` will also show the complete migrations files that would be -written. +Shows what migrations would be made without actually writing any migrations +files to disk. Using this option along with ``--verbosity 3`` will also show +the complete migrations files that would be written. .. django-admin-option:: --merge -The ``--merge`` option enables fixing of migration conflicts. +Enables fixing of migration conflicts. -.. django-admin-option:: --name, -n +.. django-admin-option:: --name NAME, -n NAME -The ``--name`` option allows you to give the migration(s) a custom name instead -of a generated one. +Allows naming the generated migration(s) instead of using a generated name. .. django-admin-option:: --exit, -e .. deprecated:: 1.10 - Use the :djadminopt:`--check` option instead. + Use the ``--check`` option instead. -The ``--exit`` option will cause ``makemigrations`` to exit with error code 1 -when no migrations are created (or would have been created, if combined with -``--dry-run``). +Makes ``makemigrations`` exit with error code 1 when no migrations are created +(or would have been created, if combined with ``--dry-run``). .. django-admin-option:: --check .. versionadded:: 1.10 -The ``--check`` option makes ``makemigrations`` exit with a non-zero status -when model changes without migrations are detected. +Makes ``makemigrations`` exit with a non-zero status when model changes without +migrations are detected. -migrate [<app_label> [<migrationname>]] ---------------------------------------- +migrate +------- -.. django-admin:: migrate +.. django-admin:: migrate [app_label] [migration_name] Synchronizes the database state with the current set of models and migrations. Migrations, their relationship with apps and more are covered in depth in @@ -733,14 +740,14 @@ The behavior of this command changes depending on the arguments provided: migrated past the named migration. Use the name ``zero`` to unapply all migrations for an app. -The :djadminopt:`--database` option can be used to specify the database to -migrate. +.. django-admin-option:: --database DATABASE + +Specifies the database to migrate. Defaults to ``default``. .. django-admin-option:: --fake -The ``--fake`` option tells Django to mark the migrations as having been -applied or unapplied, but without actually running the SQL to change your -database schema. +Tells Django to mark the migrations as having been applied or unapplied, but +without actually running the SQL to change your database schema. This is intended for advanced users to manipulate the current migration state directly if they're manually applying changes; @@ -750,9 +757,9 @@ run correctly. .. django-admin-option:: --fake-initial -The ``--fake-initial`` option can be used to allow Django to skip an app's -initial migration if all database tables with the names of all models created -by all :class:`~django.db.migrations.operations.CreateModel` operations in that +Allows Django to skip an app's initial migration if all database tables with +the names of all models created by all +:class:`~django.db.migrations.operations.CreateModel` operations in that migration already exist. This option is intended for use when first running migrations against a database that preexisted the use of migrations. This option does not, however, check for matching database schema beyond matching @@ -763,14 +770,14 @@ schema matches what is recorded in your initial migration. .. versionadded:: 1.9 -The ``--run-syncdb`` option allows creating tables for apps without migrations. -While this isn't recommended, the migrations framework is sometimes too slow -on large projects with hundreds of models. +Allows creating tables for apps without migrations. While this isn't +recommended, the migrations framework is sometimes too slow on large projects +with hundreds of models. -runserver [port or address:port] --------------------------------- +runserver +--------- -.. django-admin:: runserver +.. django-admin:: runserver [addrport] Starts a lightweight development Web server on the local machine. By default, the server runs on port 8000 on the IP address ``127.0.0.1``. You can pass in an @@ -837,30 +844,20 @@ Logging of each request and response of the server is sent to the .. django-admin-option:: --noreload -Use the ``--noreload`` option to disable the use of the auto-reloader. This -means any Python code changes you make while the server is running will *not* -take effect if the particular Python modules have already been loaded into -memory. - -Example usage:: - - django-admin runserver --noreload +Disables the auto-reloader. This means any Python code changes you make while +the server is running will *not* take effect if the particular Python modules +have already been loaded into memory. .. django-admin-option:: --nothreading -The development server is multithreaded by default. Use the ``--nothreading`` -option to disable the use of threading in the development server. +Disables use of threading in the development server. The server is +multithreaded by default. .. django-admin-option:: --ipv6, -6 -Use the ``--ipv6`` (or shorter ``-6``) option to tell Django to use IPv6 for -the development server. This changes the default IP address from +Uses IPv6 for the development server. This changes the default IP address from ``127.0.0.1`` to ``::1``. -Example usage:: - - django-admin runserver --ipv6 - Examples of using different ports and addresses ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -911,7 +908,7 @@ you want to configure Django to serve static media, read sendtestemail ------------- -.. django-admin:: sendtestemail +.. django-admin:: sendtestemail [email [email ...]] .. versionadded:: 1.9 @@ -920,17 +917,18 @@ recipient(s) specified. For example:: django-admin sendtestemail foo@example.com bar@example.com +There are a couple of options, and you may use any combination of them +together: + .. django-admin-option:: --managers -Use the ``--managers`` option to mail the email addresses specified in -:setting:`MANAGERS` using :meth:`~django.core.mail.mail_managers()`. +Mails the email addresses specified in :setting:`MANAGERS` using +:meth:`~django.core.mail.mail_managers()`. .. django-admin-option:: --admins -Use the ``--admins`` option to mail the email addresses specified in -:setting:`ADMINS` using :meth:`~django.core.mail.mail_admins()`. - -Note that you may use any combination of these options together. +Mails the email addresses specified in :setting:`ADMINS` using +:meth:`~django.core.mail.mail_admins()`. shell ----- @@ -939,77 +937,74 @@ shell Starts the Python interactive interpreter. -Django will use IPython_ or bpython_ if either is installed. If you have a -rich shell installed but want to force use of the "plain" Python interpreter, -use the ``-i python`` or ``--interface python`` option, like so:: - - django-admin shell -i python - django-admin shell --interface python - -.. deprecated:: 1.10 - - In older versions, use the ``--plain`` option. This is deprecated and will - be removed in Django 2.0. +.. django-admin-option:: --interface {ipython,bpython,python}, -i {ipython,bpython,python} -If you would like to specify either IPython or bpython as your interpreter if -you have both installed you can specify an alternative interpreter interface -with the ``-i`` or ``--interface`` options like so: +Specifies the shell to use. By default, Django will use IPython_ or bpython_ if +either is installed. If both are installed, specify which one you want like so: IPython:: django-admin shell -i ipython - django-admin shell --interface ipython - bpython:: django-admin shell -i bpython - django-admin shell --interface bpython +If you have a "rich" shell installed but want to force use of the "plain" +Python interpreter, use ``python`` as the interface name, like so:: + + django-admin shell -i python + +.. deprecated:: 1.10 + + In older versions, use the ``--plain`` option instead of ``-i python``. This + is deprecated and will be removed in Django 2.0. .. _IPython: http://ipython.scipy.org/ .. _bpython: http://bpython-interpreter.org/ -When the "plain" Python interactive interpreter starts (be it because -``--interface python`` was specified or because no other interactive interface -is available) it reads the script pointed to by the :envvar:`PYTHONSTARTUP` -environment variable and the ``~/.pythonrc.py`` script. If you don't wish this -behavior you can use the ``--no-startup`` option. e.g.:: +.. django-admin-option:: --nostartup - django-admin shell --interface python --no-startup +Disables reading the startup script for the "plain" Python interpreter. By +default, the script pointed to by the :envvar:`PYTHONSTARTUP` environment +variable or the ``~/.pythonrc.py`` script is read. -.. django-admin-option:: --command, -c <command> +.. django-admin-option:: --command COMMAND, -c COMMAND .. versionadded:: 1.10 -The ``--command`` option lets you pass a command as a string to execute it as -Django, like so:: +Lets you pass a command as a string to execute it as Django, like so:: django-admin shell --command="import django; print(django.__version__)" -showmigrations [<app_label> [<app_label>]] ------------------------------------------- +showmigrations +-------------- -.. django-admin:: showmigrations +.. django-admin:: showmigrations [app_label [app_label ...]] -Shows all migrations in a project. +Shows all migrations in a project. You can choose from one of two formats: .. django-admin-option:: --list, -l -The ``--list`` option lists all of the apps Django knows about, the -migrations available for each app, and whether or not each migration is -applied (marked by an ``[X]`` next to the migration name). +Lists all of the apps Django knows about, the migrations available for each +app, and whether or not each migration is applied (marked by an ``[X]`` next to +the migration name). Apps without migrations are also listed, but have ``(no migrations)`` printed under them. +This is the default output format. + .. django-admin-option:: --plan, -p -The ``--plan`` option shows the migration plan Django will follow to apply -migrations. Any supplied app labels are ignored because the plan might go -beyond those apps. Same as ``--list``, applied migrations are marked by an -``[X]``. For a verbosity of 2 and above, all dependencies of a migration will -also be shown. +Shows the migration plan Django will follow to apply migrations. Any supplied +app labels are ignored because the plan might go beyond those apps. Like +``--list``, applied migrations are marked by an ``[X]``. For a ``--verbosity`` +of 2 and above, all dependencies of a migration will also be shown. + +.. django-admin-option:: --database DATABASE + +Specifies the database to examine. Defaults to ``default``. sqlflush -------- @@ -1019,13 +1014,14 @@ sqlflush Prints the SQL statements that would be executed for the :djadmin:`flush` command. -The :djadminopt:`--database` option can be used to specify the database for -which to print the SQL. +.. django-admin-option:: --database DATABASE -sqlmigrate <app_label> <migrationname> --------------------------------------- +Specifies the database for which to print the SQL. Defaults to ``default``. -.. django-admin:: sqlmigrate +sqlmigrate +---------- + +.. django-admin:: sqlmigrate app_label migration_name 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 @@ -1033,14 +1029,14 @@ generate the SQL against a copy of the database you wish to later apply it on. Note that ``sqlmigrate`` doesn't colorize its output. -The :djadminopt:`--database` option can be used to specify the database for -which to generate the SQL. - .. django-admin-option:: --backwards -By default, the SQL created is for running the migration in the forwards -direction. Pass ``--backwards`` to generate the SQL for -unapplying the migration instead. +Generates the SQL for unapplying the migration. By default, the SQL created is +for running the migration in the forwards direction. + +.. django-admin-option:: --database DATABASE + +Specifies the database for which to generate the SQL. Defaults to ``default``. .. versionchanged:: 1.9 @@ -1048,10 +1044,10 @@ unapplying the migration instead. generated for each migration operation is preceded by the operation's description. -sqlsequencereset <app_label app_label ...> ------------------------------------------- +sqlsequencereset +---------------- -.. django-admin:: sqlsequencereset +.. django-admin:: sqlsequencereset app_label [app_label ...] Prints the SQL statements for resetting sequences for the given app name(s). @@ -1061,13 +1057,14 @@ number for automatically incremented fields. Use this command to generate SQL which will fix cases where a sequence is out of sync with its automatically incremented field data. -The :djadminopt:`--database` option can be used to specify the database for -which to print the SQL. +.. django-admin-option:: --database DATABASE -squashmigrations <app_label> [<start_migration_name>] <migration_name> ----------------------------------------------------------------------- +Specifies the database for which to print the SQL. Defaults to ``default``. -.. django-admin:: squashmigrations +squashmigrations +---------------- + +.. django-admin:: squashmigrations app_label [start_migration_name] migration_name Squashes the migrations for ``app_label`` up to and including ``migration_name`` down into fewer migrations, if possible. The resulting squashed migrations @@ -1083,17 +1080,24 @@ squashing limitation of :class:`~django.db.migrations.operations.RunPython` and .. django-admin-option:: --no-optimize -By default, Django will try to optimize the operations in your migrations -to reduce the size of the resulting file. Pass ``--no-optimize`` if this -process is failing for you or creating incorrect migrations, though please -also file a Django bug report about the behavior, as optimization is meant -to be safe. +Disables the optimizer when generating a squashed migration. By default, Django +will try to optimize the operations in your migrations to reduce the size of +the resulting file. Use this option if this process is failing or creating +incorrect migrations, though please also file a Django bug report about the +behavior, as optimization is meant to be safe. + +.. django-admin-option:: --noinput, --no-input + +Suppresses all user prompts. +.. versionchanged:: 1.9 -startapp <app_label> [destination] ----------------------------------- + The ``--no-input`` alias was added. -.. django-admin:: startapp +startapp +-------- + +.. django-admin:: startapp name [directory] Creates a Django app directory structure for the given app name in the current directory or the given destination. @@ -1113,10 +1117,9 @@ For example:: .. _custom-app-and-project-templates: -.. django-admin-option:: --template +.. django-admin-option:: --template TEMPLATE -With the ``--template`` option, you can use a custom app template by providing -either the path to a directory with the app template file, or a path to a +Provides the path to a directory with a custom app template file or a path to a compressed file (``.tar.gz``, ``.tar.bz2``, ``.tgz``, ``.tbz``, ``.zip``) containing the app template files. @@ -1134,11 +1137,19 @@ zip files, you can use a URL like:: django-admin startapp --template=https://github.com/githubuser/django-app-template/archive/master.zip myapp -When Django copies the app template files, it also renders certain files -through the template engine: the files whose extensions match the -``--extension`` option (``py`` by default) and the files whose names are passed -with the ``--name`` option. The :class:`template context -<django.template.Context>` used is: +.. django-admin-option:: --extension EXTENSIONS, -e EXTENSIONS + +Specifies which file extensions in the app template should be rendered with the +template engine. Defaults to ``py``. + +.. django-admin-option:: --name FILES, -n FILES + +Specifies which files in the app template (in addition to those matching +``--extension``) should be rendered with the template engine. Defaults to an +empty list. + +The :class:`template context <django.template.Context>` used for all matching +files is: - Any option passed to the ``startapp`` command (among the command's supported options) @@ -1166,10 +1177,10 @@ with the ``--name`` option. The :class:`template context .. _source: https://github.com/django/django/tree/master/django/conf/app_template/ -startproject <projectname> [destination] ----------------------------------------- +startproject +------------ -.. django-admin:: startproject +.. django-admin:: startproject name [directory] Creates a Django project directory structure for the given project name in the current directory or the given destination. @@ -1190,30 +1201,23 @@ For example:: django-admin startproject myproject /Users/jezdez/Code/myproject_repo -As with the :djadmin:`startapp` command, the ``--template`` option lets you -specify a directory, file path or URL of a custom project template. See the -:djadmin:`startapp` documentation for details of supported project template -formats. +.. django-admin-option:: --template TEMPLATE -For example, this would look for a project template in the given directory -when creating the ``myproject`` project:: +Specifies a directory, file path, or URL of a custom project template. See the +:option:`startapp --template` documentation for examples and usage. - django-admin startproject --template=/Users/jezdez/Code/my_project_template myproject +.. django-admin-option:: --extension EXTENSIONS, -e EXTENSIONS -Django will also accept URLs (``http``, ``https``, ``ftp``) to compressed -archives with the project template files, downloading and extracting them on the -fly. +Specifies which file extensions in the project template should be rendered with +the template engine. Defaults to ``py``. -For example, taking advantage of GitHub's feature to expose repositories as -zip files, you can use a URL like:: +.. django-admin-option:: --name FILES, -n FILES - django-admin startproject --template=https://github.com/githubuser/django-project-template/archive/master.zip myproject +Specifies which files in the project template (in addition to those matching +``--extension``) should be rendered with the template engine. Defaults to an +empty list. -When Django copies the project template files, it also renders certain files -through the template engine: the files whose extensions match the -``--extension`` option (``py`` by default) and the files whose names are passed -with the ``--name`` option. The :class:`template context -<django.template.Context>` used is: +The :class:`template context <django.template.Context>` used is: - Any option passed to the ``startproject`` command (among the command's supported options) @@ -1227,64 +1231,75 @@ for :djadmin:`startapp`. .. _`template source`: https://github.com/django/django/tree/master/django/conf/project_template/ -test <app or test identifier> ------------------------------ +test +---- -.. django-admin:: test +.. django-admin:: test [test_label [test_label ...]] -Runs tests for all installed models. See :doc:`/topics/testing/index` for more +Runs tests for all installed apps. See :doc:`/topics/testing/index` for more information. .. django-admin-option:: --failfast -The ``--failfast`` option can be used to stop running tests and report the -failure immediately after a test fails. +Stops running tests and reports the failure immediately after a test fails. -.. django-admin-option:: --testrunner +.. django-admin-option:: --testrunner TESTRUNNER -The ``--testrunner`` option can be used to control the test runner class that -is used to execute tests. If this value is provided, it overrides the value -provided by the :setting:`TEST_RUNNER` setting. +Controls the test runner class that is used to execute tests. This value +overrides the value provided by the :setting:`TEST_RUNNER` setting. -.. django-admin-option:: --liveserver +.. django-admin-option:: --liveserver LIVESERVER -The ``--liveserver`` option can be used to override the default address where -the live server (used with :class:`~django.test.LiveServerTestCase`) is -expected to run from. The default value is ``localhost:8081-8179``. +Overrides the default address where the live server (used with +:class:`~django.test.LiveServerTestCase`) is expected to run from. The default +value is ``localhost:8081-8179``. .. versionchanged:: 1.9 In earlier versions, the default value was ``localhost:8081``. -.. django-admin-option:: --keepdb +.. django-admin-option:: --noinput, --no-input + +Suppresses all user prompts. A typical prompt is a warning about deleting an +existing test database. + +.. versionchanged:: 1.9 + + The ``--no-input`` alias was added. + +Test runner options +~~~~~~~~~~~~~~~~~~~ + +The ``test`` command receives options on behalf of the specified +:option:`--testrunner`. These are the options of the default test runner: +:class:`~django.test.runner.DiscoverRunner`. + +.. django-admin-option:: --keepdb, -k -The ``--keepdb`` option can be used to preserve the test database between test -runs. This has the advantage of skipping both the create and destroy actions -which can greatly decrease the time to run tests, especially those in a large -test suite. If the test database does not exist, it will be created on the first -run and then preserved for each subsequent run. Any unapplied migrations will also -be applied to the test database before running the test suite. +Preserves the test database between test runs. This has the advantage of +skipping both the create and destroy actions which can greatly decrease the +time to run tests, especially those in a large test suite. If the test database +does not exist, it will be created on the first run and then preserved for each +subsequent run. Any unapplied migrations will also be applied to the test +database before running the test suite. -.. django-admin-option:: --reverse +.. django-admin-option:: --reverse, -r -The ``--reverse`` option can be used to sort test cases in the opposite order. -This may help in debugging the side effects of tests that aren't properly -isolated. :ref:`Grouping by test class <order-of-tests>` is preserved when using -this option. +Sorts test cases in the opposite execution order. This may help in debugging +the side effects of tests that aren't properly isolated. :ref:`Grouping by test +class <order-of-tests>` is preserved when using this option. -.. django-admin-option:: --debug-sql +.. django-admin-option:: --debug-sql, -d -The ``--debug-sql`` option can be used to enable :ref:`SQL logging -<django-db-logger>` for failing tests. If :djadminopt:`--verbosity` is ``2``, -then queries in passing tests are also output. +Enables :ref:`SQL logging <django-db-logger>` for failing tests. If +``--verbosity`` is ``2``, then queries in passing tests are also output. -.. django-admin-option:: --parallel +.. django-admin-option:: --parallel [N] .. versionadded:: 1.9 -The ``--parallel`` option can be used to run tests in parallel in separate -processes. Since modern processors have multiple cores, this allows running -tests significantly faster. +Runs tests in separate parallel processes. Since modern processors have +multiple cores, this allows running tests significantly faster. By default ``--parallel`` runs one process per core according to :func:`multiprocessing.cpu_count()`. You can adjust the number of processes @@ -1324,10 +1339,10 @@ don't. in order to exchange them between processes. See :ref:`python:pickle-picklable` for details. -testserver <fixture fixture ...> --------------------------------- +testserver +---------- -.. django-admin:: testserver +.. django-admin:: testserver [fixture [fixture ...]] Runs a Django development server (as in :djadmin:`runserver`) using data from the given fixture(s). @@ -1362,12 +1377,11 @@ Note that this server does *not* automatically detect changes to your Python source code (as :djadmin:`runserver` does). It does, however, detect changes to templates. -.. django-admin-option:: --addrport [port number or ipaddr:port] +.. django-admin-option:: --addrport ADDRPORT -Use ``--addrport`` to specify a different port, or IP address and port, from -the default of ``127.0.0.1:8000``. This value follows exactly the same format and -serves exactly the same function as the argument to the :djadmin:`runserver` -command. +Specifies a different port, or IP address and port, from the default of +``127.0.0.1:8000``. This value follows exactly the same format and serves +exactly the same function as the argument to the :djadmin:`runserver` command. Examples: @@ -1384,8 +1398,14 @@ To run on 1.2.3.4:7000 with a ``test`` fixture:: django-admin testserver --addrport 1.2.3.4:7000 test -The :djadminopt:`--noinput` option may be provided to suppress all user -prompts. +.. django-admin-option:: --noinput, --no-input + +Suppresses all user prompts. A typical prompt is a warning about deleting an +existing test database. + +.. versionchanged:: 1.9 + + The ``--no-input`` alias was added. Commands provided by applications ================================= @@ -1401,7 +1421,7 @@ their application. changepassword ~~~~~~~~~~~~~~ -.. django-admin:: changepassword +.. django-admin:: changepassword [<username>] This command is only available if Django's :doc:`authentication system </topics/auth/index>` (``django.contrib.auth``) is installed. @@ -1411,8 +1431,9 @@ 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. -Use the ``--database`` option to specify the database to query for the user. If -it's not supplied, Django will use the ``default`` database. +.. django-admin-option:: --database DATABASE + +Specifies the database to query for the user. Defaults to ``default``. Example usage:: @@ -1435,16 +1456,17 @@ the new superuser account. When run non-interactively, no password will be set, and the superuser account will not be able to log in until a password has been manually set for it. -.. django-admin-option:: --username -.. django-admin-option:: --email +.. django-admin-option:: --username USERNAME +.. django-admin-option:: --email EMAIL The username and email address for the new account can be supplied by using the ``--username`` and ``--email`` arguments on the command line. If either of those is not supplied, ``createsuperuser`` will prompt for it when running interactively. -Use the ``--database`` option to specify the database into which the superuser -object will be saved. +.. django-admin-option:: --database DATABASE + +Specifies the database into which the superuser object will be saved. You can subclass the management command and override ``get_input_data()`` if you want to customize data input and validation. Consult the source code for @@ -1512,117 +1534,72 @@ Please refer to its :djadmin:`description <findstatic>` in the :doc:`staticfiles Default options =============== +.. program:: None + Although some commands may allow their own custom options, every command allows for the following options: -.. django-admin-option:: --pythonpath - -Example usage:: - - django-admin migrate --pythonpath='/home/djangoprojects/myproject' +.. django-admin-option:: --pythonpath PYTHONPATH Adds the given filesystem path to the Python `import search path`_. If this isn't provided, ``django-admin`` will use the ``PYTHONPATH`` environment variable. -Note that this option is unnecessary in ``manage.py``, because it takes care of -setting the Python path for you. +This option is unnecessary in ``manage.py``, because it takes care of setting +the Python path for you. -.. _import search path: http://www.diveintopython.net/getting_to_know_python/everything_is_an_object.html +Example usage:: -.. django-admin-option:: --settings + django-admin migrate --pythonpath='/home/djangoprojects/myproject' -Example usage:: +.. _import search path: http://www.diveintopython.net/getting_to_know_python/everything_is_an_object.html - django-admin migrate --settings=mysite.settings +.. django-admin-option:: --settings SETTINGS -Explicitly specifies the settings module to use. The settings module should be -in Python package syntax, e.g. ``mysite.settings``. If this isn't provided, -``django-admin`` will use the ``DJANGO_SETTINGS_MODULE`` environment -variable. +Specifies the settings module to use. The settings module should be in Python +package syntax, e.g. ``mysite.settings``. If this isn't provided, +``django-admin`` will use the ``DJANGO_SETTINGS_MODULE`` environment variable. -Note that this option is unnecessary in ``manage.py``, because it uses +This option is unnecessary in ``manage.py``, because it uses ``settings.py`` from the current project by default. -.. django-admin-option:: --traceback - Example usage:: - django-admin migrate --traceback + django-admin migrate --settings=mysite.settings -By default, ``django-admin`` will show a simple error message whenever a -:exc:`~django.core.management.CommandError` occurs, but a full stack trace -for any other exception. If you specify ``--traceback``, ``django-admin`` -will also output a full stack trace when a ``CommandError`` is raised. +.. django-admin-option:: --traceback -.. django-admin-option:: --verbosity +Displays a full stack trace when a :exc:`~django.core.management.CommandError` +is raised. By default, ``django-admin`` will show a simple error message when a +``CommandError`` occurs and a full stack trace for any other exception. Example usage:: - django-admin migrate --verbosity 2 + django-admin migrate --traceback + +.. django-admin-option:: --verbosity {0,1,2,3}, --v {0,1,2,3} -Use ``--verbosity`` to specify the amount of notification and debug information -that ``django-admin`` should print to the console. +Specifies the amount of notification and debug information that a command +should print to the console. * ``0`` means no output. * ``1`` means normal output (default). * ``2`` means verbose output. * ``3`` means *very* verbose output. -.. django-admin-option:: --no-color - Example usage:: - django-admin runserver --no-color - -By default, ``django-admin`` will format the output to be colorized. For -example, errors will be printed to the console in red and SQL statements will -be syntax highlighted. To prevent this and have a plain text output, pass the -``--no-color`` option when running your command. - -Common options -============== - -The following options are not available on every command, but they are common -to a number of commands. - -.. django-admin-option:: --database - -Used to specify the database on which a command will operate. If not -specified, this option will default to an alias of ``default``. - -For example, to dump data from the database with the alias ``master``:: - - django-admin dumpdata --database=master - -.. django-admin-option:: --exclude - -Exclude a specific application from the applications whose contents is -output. For example, to specifically exclude the ``auth`` application from -the output of dumpdata, you would call:: - - django-admin dumpdata --exclude=auth - -If you want to exclude multiple applications, use multiple ``--exclude`` -directives:: - - django-admin dumpdata --exclude=auth --exclude=contenttypes - -.. django-admin-option:: --locale - -Use the ``--locale`` or ``-l`` option to specify the locale to process. -If not provided all locales are processed. + django-admin migrate --verbosity 2 -.. django-admin-option:: --noinput +.. django-admin-option:: --no-color -Use the ``--noinput`` option to suppress all user prompting, such as "Are -you sure?" confirmation messages. This is useful if ``django-admin`` is -being executed as an unattended, automated script. You can use ``--no-input`` -as an alias for this option. +Disables colorized command output. Some commands format their output to be +colorized. For example, errors will be printed to the console in red and SQL +statements will be syntax highlighted. -.. versionchanged:: 1.9 +Example usage:: - The ``--no-input`` alias was added. + django-admin runserver --no-color Extra niceties ============== diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt index 10c5075919..f627d8a333 100644 --- a/docs/ref/settings.txt +++ b/docs/ref/settings.txt @@ -1830,8 +1830,8 @@ When you supply ``None`` as a value for an app, Django will consider the app as an app without migrations regardless of an existing ``migrations`` submodule. This can be used, for example, in a test settings file to skip migrations while testing (tables will still be created for the apps' models). If this is used in -your general project settings, remember to use the migrate -:djadminopt:`--run-syncdb` option if you want to create tables for the app. +your general project settings, remember to use the :option:`migrate +--run-syncdb` option if you want to create tables for the app. .. setting:: MONTH_DAY_FORMAT diff --git a/docs/ref/signals.txt b/docs/ref/signals.txt index ca6f9c2de6..a4696a811f 100644 --- a/docs/ref/signals.txt +++ b/docs/ref/signals.txt @@ -389,7 +389,7 @@ Arguments sent with this signal: ``verbosity`` Indicates how much information manage.py is printing on screen. See - the :djadminopt:`--verbosity` flag for details. + the :option:`--verbosity` flag for details. Functions which listen for :data:`pre_migrate` should adjust what they output to the screen based on the value of this argument. @@ -430,7 +430,7 @@ Arguments sent with this signal: ``verbosity`` Indicates how much information manage.py is printing on screen. See - the :djadminopt:`--verbosity` flag for details. + the :option:`--verbosity` flag for details. Functions which listen for :data:`post_migrate` should adjust what they output to the screen based on the value of this argument. |
