Django

Code

Changeset 3252

Show
Ignore:
Timestamp:
06/30/06 22:31:14 (2 years ago)
Author:
adrian
Message:

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/docs/settings.txt

    r3247 r3252  
    108108============================= 
    109109 
    110 In your Django apps, use settings by importing them from 
     110In your Django apps, use settings by importing the object 
    111111``django.conf.settings``. Example:: 
    112112 
    113     from django.conf.settings import DEBUG 
    114  
    115     if DEBUG: 
     113    from django.conf import settings 
     114 
     115    if settings.DEBUG: 
    116116        # Do something 
    117117 
    118 Note that your code should *not* import from either ``global_settings`` or 
     118Note that ``django.conf.settings`` isn't a module -- it's an object. So 
     119importing individual settings is not possible:: 
     120 
     121    from django.conf.settings import DEBUG  # This won't work. 
     122 
     123Also note that your code should *not* import from either ``global_settings`` or 
    119124your own settings file. ``django.conf.settings`` abstracts the concepts of 
    120125default settings and site-specific settings; it presents a single interface. 
     
    128133don't do this in a view:: 
    129134 
    130     from django.conf.settings import DEBUG 
    131  
    132     DEBUG = True   # Don't do this! 
     135    from django.conf import settings 
     136 
     137    settings.DEBUG = True   # Don't do this! 
    133138 
    134139The only place you should assign to settings is in a settings file.