mirror of https://github.com/django/django.git
Fix issue #18267 - document `settings.configured` property.
This commit is contained in:
parent
00c0d3c44e
commit
59d2b8aa16
|
@ -220,7 +220,7 @@ In this example, default settings are taken from ``myapp_defaults``, and the
|
||||||
The following example, which uses ``myapp_defaults`` as a positional argument,
|
The following example, which uses ``myapp_defaults`` as a positional argument,
|
||||||
is equivalent::
|
is equivalent::
|
||||||
|
|
||||||
settings.configure(myapp_defaults, DEBUG = True)
|
settings.configure(myapp_defaults, DEBUG=True)
|
||||||
|
|
||||||
Normally, you will not need to override the defaults in this fashion. The
|
Normally, you will not need to override the defaults in this fashion. The
|
||||||
Django defaults are sufficiently tame that you can safely use them. Be aware
|
Django defaults are sufficiently tame that you can safely use them. Be aware
|
||||||
|
@ -242,7 +242,16 @@ is accessed.
|
||||||
|
|
||||||
If you set ``DJANGO_SETTINGS_MODULE``, access settings values somehow, *then*
|
If you set ``DJANGO_SETTINGS_MODULE``, access settings values somehow, *then*
|
||||||
call ``configure()``, Django will raise a ``RuntimeError`` indicating
|
call ``configure()``, Django will raise a ``RuntimeError`` indicating
|
||||||
that settings have already been configured.
|
that settings have already been configured. There is a property just for this
|
||||||
|
purpose:
|
||||||
|
|
||||||
|
.. attribute: django.conf.settings.configured
|
||||||
|
|
||||||
|
For example::
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
if not settings.configured:
|
||||||
|
settings.configure(myapp_defaults, DEBUG=True)
|
||||||
|
|
||||||
Also, it's an error to call ``configure()`` more than once, or to call
|
Also, it's an error to call ``configure()`` more than once, or to call
|
||||||
``configure()`` after any setting has been accessed.
|
``configure()`` after any setting has been accessed.
|
||||||
|
|
Loading…
Reference in New Issue