2

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://...,
}
taleinat
  • 8,441
  • 1
  • 30
  • 44
  • It would help to see more of your configuration, by default Sentry only works with DEBUG=False and the debug-toolbar only works with DEBUG=True – armonge May 07 '13 at 14:57
  • When I comment out `django-debug-toolbar` from my `settings.py` (both in `MIDDLEWARE_CLASSES` and `INSTALLED_APPS`), my errors are sent to Sentry just fine, despite `DEBUG=True`. – taleinat May 07 '13 at 15:00
  • @armonge: I've added the relevant parts of my settings.py. – taleinat May 07 '13 at 15:05
  • This doesn't sound right to me, DEBUG=True should only be used for developing. Why do you want to log all exceptions while developing? Or even worse if you're not developing: why do you run in DEBUG mode in production? – Bouke Jul 28 '13 at 08:21

0 Answers0