From 3853c6f4a93bf6384e51fa91b9a69e1c1c95ff89 Mon Sep 17 00:00:00 2001
From: Todd Dembrey <todd.dembrey@torchbox.com>
Date: Thu, 19 Jul 2018 08:41:58 +0100
Subject: [PATCH] Make sure the sentry dsn isnt run on tests and update to
 avoid bug on live

Upgrade raven to >= 6.4.0
https://github.com/getsentry/raven-python/issues/1127
---
 opentech/settings/production.py | 16 ++++++++++------
 requirements.txt                |  2 +-
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/opentech/settings/production.py b/opentech/settings/production.py
index 410aff444..131e63638 100644
--- a/opentech/settings/production.py
+++ b/opentech/settings/production.py
@@ -11,12 +11,6 @@ from .base import *  # noqa
 # Disable debug mode
 DEBUG = False
 
-# Raven (sentry) configuration. See local settings for DSN
-
-INSTALLED_APPS += (
-    'raven.contrib.django.raven_compat',
-)
-
 
 # Cache everything for 10 minutes
 # This only applies to pages that do not have a more specific cache-control
@@ -29,6 +23,16 @@ CACHE_CONTROL_MAX_AGE = 600
 
 env = os.environ.copy()
 
+# Raven (sentry) configuration. See local settings for DSN
+
+if 'SENTRY_DSN' in env:
+    INSTALLED_APPS += (
+        'raven.contrib.django.raven_compat',
+    )
+
+    SENTRY_DSN = env['SENTRY_DSN']
+
+
 # On Torchbox servers, many environment variables are prefixed with "CFG_"
 for key, value in os.environ.items():
     if key.startswith('CFG_'):
diff --git a/requirements.txt b/requirements.txt
index 7c0bdc343..c70c8301f 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -29,4 +29,4 @@ dj-database-url==0.4.1
 whitenoise==2.0.4
 uwsgi==2.0.15
 ConcurrentLogHandler==0.9.1
-raven==6.1.0
+raven==6.9.0
-- 
GitLab