I'm migrating a Google App Engine application from Django 0.96 to 1.2. In the process, I noted that the settings file I specified in my main handler was not loaded anymore (instead of the 3 specified languages, Django loaded the full list of default languages from it's django/conf/global_settings.py
file).
In 0.96 I specified the file like this:
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'conf.settings'
From what I read in the documentation this is not supposed to be changed. However, when specifying version 1.2 like this:
from google.appengine.dist import use_library
use_library('django', '1.2')
conf.settings
is not imported anymore. Digging a bit in the GAE's SDK, I noted that the 0.96 and 1.2 versions of the google_appengine/lib/django_<VERS>/django/conf/__init__.py
file work differently.
In 0.96, LazySettings._import_settings
gets called from LazySettings.__getattr__
, which results in the file specified in os.environ['DJANGO_SETTINGS_MODULE']
to be imported.
In 1.2, LazySettings._setup
does not seem to be called anywhere.
If I add a manual call to settings._setup()
in my main handler, the custom settings file gets imported properly. Like this:
from django.conf import settings
settings._target = None # Force Django to reload settings
settings._setup()
However, it feels weird/wrong to have to call that private function manually... Why is my custom settings file not imported anymore?