Add Sentry logging

This commit is contained in:
Tom Price
2015-11-10 10:50:24 +00:00
parent 887e932c64
commit 2e1ab96186
3 changed files with 14 additions and 0 deletions

View File

@@ -50,9 +50,11 @@ INSTALLED_APPS = (
'reversion', 'reversion',
'captcha', 'captcha',
'widget_tweaks', 'widget_tweaks',
'raven.contrib.django.raven_compat',
) )
MIDDLEWARE_CLASSES = ( MIDDLEWARE_CLASSES = (
'raven.contrib.django.raven_compat.middleware.SentryResponseErrorIdMiddleware',
'reversion.middleware.RevisionMiddleware', 'reversion.middleware.RevisionMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware', 'django.middleware.common.CommonMiddleware',
@@ -129,6 +131,15 @@ LOGGING = {
} }
} }
import raven
RAVEN_CONFIG = {
'dsn': os.environ.get('RAVEN_DSN'),
# If you are using git, you can also automatically configure the
# release based on the git info.
'release': raven.fetch_git_sha(os.path.dirname(os.path.dirname(__file__))),
}
# User system # User system
AUTH_USER_MODEL = 'RIGS.Profile' AUTH_USER_MODEL = 'RIGS.Profile'

View File

@@ -6,5 +6,6 @@
<div class="text-center"> <div class="text-center">
<h1>500: Server error</h1> <h1>500: Server error</h1>
<img src="{% static 'imgs/500.jpg' %}"/> <img src="{% static 'imgs/500.jpg' %}"/>
<p>If you need assistance, you may reference this error as <strong>{{ request.sentry.id }}</strong>.</p>
</div> </div>
{% endblock %} {% endblock %}

View File

@@ -1,4 +1,5 @@
{% load static from staticfiles %} {% load static from staticfiles %}
{% load raven %}
<!DOCTYPE html> <!DOCTYPE html>
@@ -21,6 +22,7 @@
{% endblock %} {% endblock %}
<script src="//code.jquery.com/jquery-latest.min.js"></script> <script src="//code.jquery.com/jquery-latest.min.js"></script>
<script>Raven.config('{% sentry_public_dsn %}').install()</script>
{% block preload_js %} {% block preload_js %}
{% endblock %} {% endblock %}