Sentry-python: How to disable sentry in DEBUG mode in django

Created on 30 Apr 2019  路  3Comments  路  Source: getsentry/sentry-python

Hi,

This is my first time using Sentry, and it worked really easily with Django. However, I can't find any information about how to configure sentry using the Django logging configuration, except for the old Raven interface.

Specifically, I'd like to turn off reporting to Sentry when in DEBUG mode.

Thanks for any help.

question

Most helpful comment

You can just not call init in your settings.py. Is that sufficient?

if not DEBUG:
    sentry_sdk.init(...)

All 3 comments

You can just not call init in your settings.py. Is that sufficient?

if not DEBUG:
    sentry_sdk.init(...)

Haha, that will work I guess. Thanks! By the way, is the dsn in the init supposed to be kept secret?

Another way to filter out events is to use https://docs.sentry.io/error-reporting/configuration/filtering/?platform=python#before-send

For your question about the DSN, please refer to https://forum.sentry.io/t/dsn-private-public/6297

I hope everything goes well! I'll close this issue now, if you have a new separate question please make a new issue (I believe this helps with google-abillity of this info)

Was this page helpful?
0 / 5 - 0 ratings