Skip to content

Commit aa757ac

Browse files
Merge pull request django#43 from techtonik/patch-1
Fixed django#18267 -- document `settings.configured` property.
2 parents 5f75ac9 + 59d2b8a commit aa757ac

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

docs/topics/settings.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ In this example, default settings are taken from ``myapp_defaults``, and the
220220
The following example, which uses ``myapp_defaults`` as a positional argument,
221221
is equivalent::
222222

223-
settings.configure(myapp_defaults, DEBUG = True)
223+
settings.configure(myapp_defaults, DEBUG=True)
224224

225225
Normally, you will not need to override the defaults in this fashion. The
226226
Django defaults are sufficiently tame that you can safely use them. Be aware
@@ -242,7 +242,16 @@ is accessed.
242242

243243
If you set ``DJANGO_SETTINGS_MODULE``, access settings values somehow, *then*
244244
call ``configure()``, Django will raise a ``RuntimeError`` indicating
245-
that settings have already been configured.
245+
that settings have already been configured. There is a property just for this
246+
purpose:
247+
248+
.. attribute: django.conf.settings.configured
249+
250+
For example::
251+
252+
from django.conf import settings
253+
if not settings.configured:
254+
settings.configure(myapp_defaults, DEBUG=True)
246255

247256
Also, it's an error to call ``configure()`` more than once, or to call
248257
``configure()`` after any setting has been accessed.

0 commit comments

Comments
 (0)