Learning what DJANGO_SETTINGS_MODULE is for
I wonder which is what of the followin开发者_StackOverflowg:
os.environ['DJANGO_SETTINGS_MODULE'] = 'conf.settings'
os.environ[u'DJANGO_SETTINGS_MODULE'] = u'conf'
can you explain?
This defines the settings file name in case of production use.
In case of deployment you can use a separate settings file let us say *production_settings.py* which imports from the main settings file settings.py. You could define some separate settings for deployment like SITE_ID
, DEBUG
etc.
So in your deployment .wsgi file DJANGO_SETTINGS_MODULE
environment variable can be defined to use the separate settings file.
os.environ['DJANGO_SETTINGS_MODULE'] = 'conf.production_settings'
精彩评论