Sentry-python: Disable sentry for local development

Created on 25 Mar 2020  路  2Comments  路  Source: getsentry/sentry-python

We have a Django setup where we init() sentry in the main settings file but I have not found a simple way of disabling sentry for local development.

With Raven I was able to just overwrite logging params in local settings file that overwrites main settings file but I no I find myself just editing the main settings file to comment out the sentry init.

Is there a better way to disable sentry init without touching the settings file?

I also checked the community forums for an answer to this but it seems there are less answers than here and couldn't find anything about it in docs.

Most helpful comment

You should be able to call init() multiple times. So in your local settings file you can call init() second time without arguments (and without the SENTRY_DSN envvar set) and it will disable the SDK.

All 2 comments

You should be able to call init() multiple times. So in your local settings file you can call init() second time without arguments (and without the SENTRY_DSN envvar set) and it will disable the SDK.

Duplicate of #659

Was this page helpful?
0 / 5 - 0 ratings