diff --git a/config/settings/production.py b/config/settings/production.py index e4abdf44e..60ad36d6b 100644 --- a/config/settings/production.py +++ b/config/settings/production.py @@ -177,6 +177,17 @@ }, } +# 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, + } + # Sentry # ------------------------------------------------------------------------------ SENTRY_DSN = env("SENTRY_DSN")