diff options
author | Andy Doan <andy.doan@linaro.org> | 2016-03-02 14:56:41 -0600 |
---|---|---|
committer | Andy Doan <andy.doan@linaro.org> | 2016-03-02 14:59:47 -0600 |
commit | b0edc1bf77b3eb3a79925b01f52364116aee5d10 (patch) | |
tree | f4a59e85a7a6880dba7df1ba1a5e1c6f1173302d /wsgi_production.py | |
parent | 40a05365a6bea20fd30e70ddda39bcc6e81bdd7c (diff) |
django 1.8: fix ALLOWED_HOSTS logic
Django 1.8 is importing our settings before our wsgi code had time to
populate the environment which left it only listening to localhost.
Change-Id: I628fd86a6dbb5ca3c38653b2d5c1cbb54b552a5f
Diffstat (limited to 'wsgi_production.py')
-rw-r--r-- | wsgi_production.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/wsgi_production.py b/wsgi_production.py index 5ab7de7..1b4fb3c 100644 --- a/wsgi_production.py +++ b/wsgi_production.py @@ -5,18 +5,16 @@ here = os.path.abspath(os.path.dirname(__file__)) sys.path.append(here) os.environ["DJANGO_SETTINGS_MODULE"] = 'settings_production' -APP_ENVS = ['SITE_NAME', 'HOST_NAME'] +APP_ENVS = ['SITE_NAME'] -try: - from django.core.wsgi import get_wsgi_application - _app = get_wsgi_application() -except ImportError: - # for < django 1.6 - from django.core.handlers.wsgi import WSGIHandler - _app = WSGIHandler() +from django.core.wsgi import get_wsgi_application +_app = get_wsgi_application() def application(environ, start_response): + from django.conf import settings + settings.ALLOWED_HOSTS = [environ['HOST_NAME']] + # pass the WSGI environment variables on through to os.environ for var in APP_ENVS: os.environ[var] = environ.get(var, '') |