-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
48 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import os | ||
|
||
from urban.lsettings import * | ||
|
||
INSTALLED_APPS += ( | ||
'django_media_fixtures', | ||
) | ||
|
||
|
||
SENTRY_DSN = os.getenv("SENTRY_DSN", None) | ||
if SENTRY_DSN: | ||
import logging | ||
import sentry_sdk | ||
from sentry_sdk.integrations.django import DjangoIntegration | ||
from sentry_sdk.integrations.logging import LoggingIntegration | ||
from sentry_sdk.integrations.redis import RedisIntegration | ||
from sentry_sdk.integrations.celery import CeleryIntegration | ||
|
||
SENTRY_LOG_LEVEL = int(os.getenv("DJANGO_SENTRY_LOG_LEVEL", logging.INFO)) | ||
|
||
sentry_logging = LoggingIntegration( | ||
level=SENTRY_LOG_LEVEL, # Capture info and above as breadcrumbs | ||
event_level=logging.ERROR, # Send errors as events | ||
) | ||
|
||
integrations = [sentry_logging, DjangoIntegration(), RedisIntegration(), CeleryIntegration()] | ||
|
||
sentry_sdk.init( | ||
dsn=SENTRY_DSN, | ||
integrations=integrations, | ||
environment=os.getenv("SENTRY_ENVIRONMENT", "production"), | ||
traces_sample_rate=float(os.getenv("SENTRY_TRACES_SAMPLE_RATE", 0.1)), | ||
) | ||
|
||
LOGGING["loggers"] = { | ||
"django.db.backends": { | ||
"level": "ERROR", | ||
"handlers": ["console"], | ||
"propagate": False, | ||
}, | ||
# Errors logged by the SDK itself | ||
"sentry_sdk": {"level": "ERROR", "handlers": ["console"], "propagate": False}, | ||
"django.security.DisallowedHost": { | ||
"level": "ERROR", | ||
"handlers": ["console"], | ||
"propagate": False, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters