Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions config/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,22 @@
},
}

# Django's default mail_admins handler sends email synchronously, blocking a worker
# thread per HTTP 500; other (async/queued) handlers are recommended. Disabled by
# default and gated behind an env var; errors are already captured by Sentry.
ADMIN_ERROR_EMAILS = env.bool("DJANGO_ADMIN_ERROR_EMAILS", default=False)
if not ADMIN_ERROR_EMAILS:
LOGGING["loggers"]["django"] = {
"level": "INFO",
"handlers": ["console"],
"propagate": False,
}
Comment thread
mihow marked this conversation as resolved.
Comment thread
mihow marked this conversation as resolved.
else:
# Nothing to wire here: Django's DEFAULT_LOGGING attaches the mail_admins handler
# to the "django" logger before this module's LOGGING is applied. Explicit branch
# so the "on" path is visible here instead of hidden in Django's defaults. See #1356.
pass

# Sentry
# ------------------------------------------------------------------------------
SENTRY_DSN = env("SENTRY_DSN")
Expand Down
Loading