In your Django apps, use settings by importing the object django.conf.settings
. Example:
from django.conf import settings if settings.DEBUG: # Do something
Note that django.conf.settings
isn't a module-it's an object. So importing individual settings is not possible:
from django.conf.settings import DEBUG # This won't work.
Also note that your code should not import from either global_settings
or your own settings file. django.conf.settings
abstracts the concepts of default settings and site-specific settings; it presents a single interface. It also decouples the code that uses settings from the location of your settings.