I've installed Sentry on my Django server which already had django-debug-toolbar successfully installed and working. Errors were not sent to my Sentry server until I disabled django-debug-toolbar.
I read the docs, and there is a "caveats" section which mentions problems with other middleware which defines process_exception()
, but I checked the code and django-debug-toolbar doesn't implement this method at all.
Any help would be appreciated!
More info:
I installed the Sentry client as described here:
Start by installing raven-python:
pip install raven
Then simply modify your Django configuration:
# Set your DSN value RAVEN_CONFIG = { 'dsn': 'https://...', } # Add raven to the list of installed apps INSTALLED_APPS = INSTALLED_APPS + ( # ... 'raven.contrib.django.raven_compat', )
That's it! Raven automatically installs an error handling hook to pipe all uncaught exceptions to Sentry.
From my settings.py
:
DEBUG = True
MIDDLEWARE_CLASSES = (
'AppServer.middleware.startup.StartupMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.humanize',
# Uncomment the next line to enable the admin:
# 'django.contrib.admin',
'raven.contrib.django.raven_compat',
'debug_toolbar',
)
SHOW_TOOLBAR_CALLBACK = lambda request: True
RAVEN_CONFIG = {
'dsn': 'https://...,
}