From 5fecdf84053ca1083cd16d54a58d64191c938ae4 Mon Sep 17 00:00:00 2001 From: yunti Date: Thu, 17 Sep 2015 19:49:25 +0100 Subject: [PATCH] Fix for wsgi.py for Raven in dev --- {{cookiecutter.repo_name}}/config/wsgi.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/{{cookiecutter.repo_name}}/config/wsgi.py b/{{cookiecutter.repo_name}}/config/wsgi.py index 47f60dd4..afaaa9bb 100644 --- a/{{cookiecutter.repo_name}}/config/wsgi.py +++ b/{{cookiecutter.repo_name}}/config/wsgi.py @@ -20,7 +20,10 @@ from django.core.wsgi import get_wsgi_application from whitenoise.django import DjangoWhiteNoise {%- endif %} {% if cookiecutter.use_sentry == "y" -%} -from raven.contrib.django.raven_compat.middleware.wsgi import Sentry +if os.environ.get("DJANGO_SETTINGS_MODULE") == "config.settings.production": + from raven.contrib.django.raven_compat.middleware.wsgi import Sentry +else: + pass {%- endif %} # We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks @@ -40,7 +43,10 @@ application = get_wsgi_application() application = DjangoWhiteNoise(application) {%- endif %} {% if cookiecutter.use_sentry == "y" -%} -application = Sentry(application) +if os.environ.get("DJANGO_SETTINGS_MODULE") == "config.settings.production": + application = Sentry(application) +else: + pass {%- endif %} # Apply WSGI middleware here.