Changeset 3252
- Timestamp:
- 06/30/06 22:31:14 (2 years ago)
- Files:
-
- django/trunk/docs/settings.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/docs/settings.txt
r3247 r3252 108 108 ============================= 109 109 110 In your Django apps, use settings by importing the m from110 In your Django apps, use settings by importing the object 111 111 ``django.conf.settings``. Example:: 112 112 113 from django.conf .settings import DEBUG114 115 if DEBUG:113 from django.conf import settings 114 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. … … 128 133 don't do this in a view:: 129 134 130 from django.conf .settings import DEBUG131 132 DEBUG = True # Don't do this!135 from django.conf import settings 136 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.
