--- title: Suppress Django error reporting email date: 2023-03-09 01:54:36.426878 UTC --- In Django, by default, when an exception raises, and is not handled, Django will send an email to people listed in `ADMINS`, [reporting](https://docs.djangoproject.com/en/stable/howto/error-reporting/#server-errors) the error. But in many setup, we already have other mechanism to track those errors (like throwing to [Sentry](https://sentry.io)), so those emails will become annoying. How to stop Django from sending those emails. We can do it by overriding `mail_admins` log handler, to use `logging.NullHandler` as handler class, like this: ```py LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'handlers': { 'mail_admins': { 'level': 'ERROR', 'class': 'logging.NullHandler', } }, 'loggers': { 'django.request': { 'handlers': ['mail_admins'], 'level': 'ERROR', 'propagate': False, }, }, } ```