You can have a very minimal settings.py file in Django 1.7. Have you ever wondered how Django provides all the default settings?
All the default settings are defined in the module django/conf/global_settings.
There is usually no need to access the global_setting directly as explained in the doc..
The settings object will automatically get the default from the global_setting module on demand:
from django.conf import settings if settings.DEBUG: # Do something
Or you can override a setting in settings.py like below:
DEBUG = True
However, if you ever want to add something to an existing setting instead of replacing it, you will need to do something like below in settings.py:
from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS TEMPLATE_CONTEXT_PROCESSORS += ( 'django.core.context_processors.request', )
No comments:
Post a Comment