Fix for wsgi.py for Raven in dev

This commit is contained in:
yunti 2015-09-17 19:49:25 +01:00
parent 8be2f14cb4
commit 5fecdf8405

View File

@ -20,7 +20,10 @@ from django.core.wsgi import get_wsgi_application
from whitenoise.django import DjangoWhiteNoise from whitenoise.django import DjangoWhiteNoise
{%- endif %} {%- endif %}
{% if cookiecutter.use_sentry == "y" -%} {% 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 %} {%- endif %}
# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks # We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks
@ -40,7 +43,10 @@ application = get_wsgi_application()
application = DjangoWhiteNoise(application) application = DjangoWhiteNoise(application)
{%- endif %} {%- endif %}
{% if cookiecutter.use_sentry == "y" -%} {% if cookiecutter.use_sentry == "y" -%}
application = Sentry(application) if os.environ.get("DJANGO_SETTINGS_MODULE") == "config.settings.production":
application = Sentry(application)
else:
pass
{%- endif %} {%- endif %}
# Apply WSGI middleware here. # Apply WSGI middleware here.