Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
Configure Sentry to not send django.security.DisallowedHost errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Apr 24, 2020
1 parent aaa0f86 commit 409e932
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ocdstoucan/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import sentry_sdk
from django.utils.translation import gettext_lazy as _
from sentry_sdk.integrations.django import DjangoIntegration
from sentry_sdk.integrations.logging import ignore_logger
from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
Expand Down Expand Up @@ -140,6 +141,7 @@
('es', _('Spanish')),
]

# https://docs.djangoproject.com/en/2.2/topics/logging/#django-security
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
Expand All @@ -160,6 +162,8 @@
OCDS_TOUCAN_MAXFILESIZE = os.getenv('OCDS_TOUCAN_MAXFILESIZE', 10000000) # in bytes

if os.getenv('SENTRY_DSN') is not None:
# https://docs.sentry.io/platforms/python/logging/#ignoring-a-logger
ignore_logger('django.security.DisallowedHost')
sentry_sdk.init(
dsn=os.getenv('SENTRY_DSN'),
integrations=[DjangoIntegration(), SqlalchemyIntegration()]
Expand Down

0 comments on commit 409e932

Please sign in to comment.