From 67c83837bddf1732328cfcf7d62f01d7de7f9f37 Mon Sep 17 00:00:00 2001 From: Wiktork Date: Tue, 3 Jan 2023 14:45:46 +0100 Subject: [PATCH] feat: add email error handler --- document_merge_service/settings.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/document_merge_service/settings.py b/document_merge_service/settings.py index 1751965f..5f928a04 100644 --- a/document_merge_service/settings.py +++ b/document_merge_service/settings.py @@ -235,9 +235,22 @@ def parse_admins(admins): "level": "WARNING", "filters": None, "class": "logging.StreamHandler", - } + }, + "mail_admins": { + "level": "ERROR", + "filters": None, + "class": "django.utils.log.AdminEmailHandler", + }, }, - "loggers": {"django": {"handlers": ["console"], "level": "WARNING"}}, + "loggers": {"django": {"handlers": ["console", "mail_admins"], "level": "WARNING"}}, } URL_PREFIX = env.str("URL_PREFIX", default="") + +# Email settings +SERVER_MAIL = env.str("SERVER_MAIL", default="root@localhost") +EMAIL_HOST = env.str("EMAIL_HOST", default="localhost") +EMAIL_PORT = env.int("EMAIL_PORT", default=25) +EMAIL_HOST_USER = env.str("EMAIL_HOST_USER", default="") +EMAIL_HOST_PASSWORD = env.str("EMAIL_HOST_PASSWORD", default="") +EMAIL_USE_TLS = env.bool("EMAIL_USE_TLS", default=False)