Skip to content

Commit

Permalink
Stop sending DisallowedHost errors to Sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
dansahagian committed Jul 29, 2024
1 parent bfbc189 commit 1b60b25
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions fbsurvivor/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,18 @@
INSTALLED_APPS.append("debug_toolbar")
MIDDLEWARE.append("debug_toolbar.middleware.DebugToolbarMiddleware")


def before_send(event, hint):
if "log_record" in hint:
if hint["log_record"].name == "django.security.DisallowedHost":
return None
return event


sentry_sdk.init(
dsn=config("SENTRY_DSN", ""),
integrations=[DjangoIntegration()],
before_send=before_send,
# 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,
Expand Down

0 comments on commit 1b60b25

Please sign in to comment.