Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #2274 -- Fixed error in settings documentation. Thanks, Le Roux…

… Bodenstein

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3252 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit e37bb07bc6804b852adb6846b59f555b918b6684 1 parent bd6a758
Adrian Holovaty authored July 01, 2006

Showing 1 changed file with 11 additions and 6 deletions. Show diff stats Hide diff stats

  1. 17  docs/settings.txt
17  docs/settings.txt
@@ -107,15 +107,20 @@ For more, see the `diffsettings documentation`_.
107 107
 Using settings in Python code
108 108
 =============================
109 109
 
110  
-In your Django apps, use settings by importing them from
  110
+In your Django apps, use settings by importing the object
111 111
 ``django.conf.settings``. Example::
112 112
 
113  
-    from django.conf.settings import DEBUG
  113
+    from django.conf import settings
114 114
 
115  
-    if DEBUG:
  115
+    if settings.DEBUG:
116 116
         # Do something
117 117
 
118  
-Note that your code should *not* import from either ``global_settings`` or
  118
+Note that ``django.conf.settings`` isn't a module -- it's an object. So
  119
+importing individual settings is not possible::
  120
+
  121
+    from django.conf.settings import DEBUG  # This won't work.
  122
+
  123
+Also note that your code should *not* import from either ``global_settings`` or
119 124
 your own settings file. ``django.conf.settings`` abstracts the concepts of
120 125
 default settings and site-specific settings; it presents a single interface.
121 126
 It also decouples the code that uses settings from the location of your
@@ -127,9 +132,9 @@ Altering settings at runtime
127 132
 You shouldn't alter settings in your applications at runtime. For example,
128 133
 don't do this in a view::
129 134
 
130  
-    from django.conf.settings import DEBUG
  135
+    from django.conf import settings
131 136
 
132  
-    DEBUG = True   # Don't do this!
  137
+    settings.DEBUG = True   # Don't do this!
133 138
 
134 139
 The only place you should assign to settings is in a settings file.
135 140
 

0 notes on commit e37bb07

Please sign in to comment.
Something went wrong with that request. Please try again.