From ce4f1fd452aae16c0d1fccecd879153f76f6b588 Mon Sep 17 00:00:00 2001 From: Kenneth Matovu Date: Mon, 25 Aug 2014 11:20:06 +0300 Subject: [PATCH] adding sentry to production --- edtrac_project/settings/production.py | 38 +++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/edtrac_project/settings/production.py b/edtrac_project/settings/production.py index a451f4da..948144c0 100644 --- a/edtrac_project/settings/production.py +++ b/edtrac_project/settings/production.py @@ -1,4 +1,5 @@ # settings/production.py +import copy from .base import * ROUTER_PASSWORD = 'k1pr0t1ch' @@ -75,3 +76,40 @@ 'KEY_PREFIX': 'edutrac-', } } + +LOGGING['handlers']['sentry'] = { + 'level': 'ERROR', + 'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler', +} +LOGGING['root'] = { + 'level': 'WARNING', + 'handlers': ['sentry'], +} +LOGGING['loggers']['raven'] = { + 'level': 'DEBUG', + 'handlers': ['console'], + 'propagate': False, +} +LOGGING['loggers']['sentry.errors'] = { + 'level': 'DEBUG', + 'handlers': ['console'], + 'propagate': False, +} + +# raven docs say to put SentryResponseErrorIdMiddleware +# 'as high in the chain as possible' +# so this will insert raven into the top of the base +# settings.py file's MIDDLEWARE_CLASSES +TEMP = list(copy.copy(MIDDLEWARE_CLASSES)) +TEMP.insert(0, 'raven.contrib.django.raven_compat.' + 'middleware.SentryResponseErrorIdMiddleware') +TEMP.append('raven.contrib.django.raven_compat.' + 'middleware.Sentry404CatchMiddleware') +MIDDLEWARE_CLASSES = tuple(TEMP) + +INSTALLED_APPS += ["raven.contrib.django.raven_compat"] + + +RAVEN_CONFIG = { + 'dsn': 'https://879136a6744145b4b063231c453b286f:cd7b0c58e2864259befbcb974687e82c@sentry.unicefuganda.org/10728', +}