replace raven with sentry-sdk

since raven is now deprecated, this is how we should integrate sentry into our django projects: via the new pip install sentry-sdk:

settings.py: No more messing around with LOGGING is required, the following code plugs right into django:

import sentry_sdk
import logging
from sentry_sdk.integrations.django import DjangoIntegration
from sentry_sdk.integrations.logging import LoggingIntegration

sentry_sdk.init(
   dsn="https://1234@sentry.io/123",
   integrations=[
      DjangoIntegration(),
      LoggingIntegration(
         level=logging.INFO, # Capture info and above as breadcrumbs
         event_level=None # Send no events from log messages
      )
   ],
   environment=env('DJANGO_ENV', 'develop'),
)

Leave a Reply

Your email address will not be published. Required fields are marked *