diff options
| author | Hasan Ramezani <hasan.r67@gmail.com> | 2019-06-21 23:38:27 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-07-02 12:55:09 +0200 |
| commit | a5308514fb4bc5086c9a16a8a24a945eeebb073c (patch) | |
| tree | 0f0eb8295a6b3cecd605acd5e20337ccabffbce9 /docs | |
| parent | 4b32d039dbb59b3c3e76587df5c58150e752d9ac (diff) | |
Fixed #27801 -- Made createsuperuser fall back to environment variables for password and required fields.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/django-admin.txt | 20 | ||||
| -rw-r--r-- | docs/releases/3.0.txt | 4 |
2 files changed, 21 insertions, 3 deletions
diff --git a/docs/ref/django-admin.txt b/docs/ref/django-admin.txt index 69e00b0428..e139c8128f 100644 --- a/docs/ref/django-admin.txt +++ b/docs/ref/django-admin.txt @@ -1560,9 +1560,23 @@ useful if you need to create an initial superuser account or if you need to programmatically generate superuser accounts for your site(s). When run interactively, this command will prompt for a password for -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. +the new superuser account. When run non-interactively, you can provide +a password by setting the ``DJANGO_SUPERUSER_PASSWORD`` environment variable. +Otherwise, 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. + +In non-interactive mode, the +:attr:`~django.contrib.auth.models.CustomUser.USERNAME_FIELD` and required +fields (listed in +:attr:`~django.contrib.auth.models.CustomUser.REQUIRED_FIELDS`) fall back to +``DJANGO_SUPERUSER_<uppercase_field_name>`` environment variables, unless they +are overridden by a command line argument. For example, to provide an ``email`` +field, you can use ``DJANGO_SUPERUSER_EMAIL`` environment variable. + +.. versionchanged:: 3.0 + + Support for using ``DJANGO_SUPERUSER_PASSWORD`` and + ``DJANGO_SUPERUSER_<uppercase_field_name>`` environment variables was added. .. django-admin-option:: --username USERNAME .. django-admin-option:: --email EMAIL diff --git a/docs/releases/3.0.txt b/docs/releases/3.0.txt index 4c33e7c309..c7f1a4e78b 100644 --- a/docs/releases/3.0.txt +++ b/docs/releases/3.0.txt @@ -102,6 +102,10 @@ Minor features password fields in :mod:`django.contrib.auth.forms` for better interaction with browser password managers. +* :djadmin:`createsuperuser` now falls back to environment variables for + password and required fields, when a corresponding command line argument + isn't provided in non-interactive mode. + :mod:`django.contrib.contenttypes` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
