Skip to content

Instantly share code, notes, and snippets.

@sanjmen
Created February 13, 2022 19:17
Show Gist options
  • Save sanjmen/7c2fbf814ff31de6d3f9f27568c22440 to your computer and use it in GitHub Desktop.
Save sanjmen/7c2fbf814ff31de6d3f9f27568c22440 to your computer and use it in GitHub Desktop.
Sentry settings for django app
# Sentry related config vars
SENTRY_ENABLED = env.bool("SENTRY_ENABLED", default=False)
SENTRY_DSN = env("SENTRY_DSN", default="")
SENTRY_ENVIRONMENT = env("SENTRY_ENVIRONMENT", default="staging")
if SENTRY_ENABLED:
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
from sentry_sdk.integrations.celery import CeleryIntegration
sentry_sdk.init(
environment=f"{SENTRY_ENVIRONMENT}",
dsn=f"{SENTRY_DSN}",
integrations=[DjangoIntegration(), CeleryIntegration()],
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment