I am trying to prevent Sentry from logging errors to my Sentry dashboard while I'm working on my local server (i.e http://127.0.0.1:8000/). The only time I want sentry to log errors to my dashboard is when my code is in production. How can I go about this? I have tried this below, but it doesn't work:
if DEBUG == True
sentry_sdk.init(
dsn=os.environ.get('SENTRY_DSN', None),
integrations=[DjangoIntegration()],
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
# We recommend adjusting this value in production.
traces_sample_rate=1.0,
# If you wish to associate users to errors (assuming you are using
# django.contrib.auth) you may enable sending PII data.
send_default_pii=True
)