On Thu, Nov 21, 2013 at 8:46 AM, Mike Starov <
mikes...@gmail.com> wrote:
> I encountered same issue in my deployment. Have you found a solution?
>
Yes I did. I am still not sure if this is a bug or intentional. It
appears that in 1.6, settings.py is now imported *before* the first
run of the WSGI application. Therefore the settings.py is loaded
before the environment variables can be setup. I now load the WSGI
application as late as possible using the following code. This way,
the settings.py isn't imported until I've received the environ from
Apache. Please feel free to use it to fix your project:
---
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")
_application = None
def application(environ, start_response):
os.environ['MY_SETTING'] = environ['MY_SETTING']
global _application
if _application is None:
from django.core.wsgi import get_wsgi_application
_application = get_wsgi_application()
return _application(environ, start_response)
---