On Thu, Nov 21, 2013 at 8:46 AM, Mike Starov <mikesta...@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)
---

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADhq2b5YFMNOoC5pdjyXUED6sAEXKMUbCcYCDZxVdpMJ1yHPtg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to