﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
32016	mail_admins configuration crashes with ImproperlyConfigured.	Susana Cárdenas Molinar	Carlton Gibson <carlton.gibson@…>	"When upgrading to Django 3.1, the following error appears when trying to start the application on Docker: 

`ValueError: Unable to configure handler 'mail_admins'`. 

The `mail_admins` section of the configuration is the same as the [https://docs.djangoproject.com/en/3.1/topics/logging/#django.utils.log.AdminEmailHandler examples] shown in the documentation. This same code is working fine in Django 3.0 and when the `mail_admins` key is commented or deleted from the configuration, everything works properly. 

This is some of the code contained in the base settings file:

{{{
DJANGO_EMAIL_ADMINS_BACKEND = os.environ.get(
    ""DJANGO_EMAIL_ADMINS_BACKEND"", ""django.core.mail.backends.console.EmailBackend""
)
LOGGING_CONFIG = None

logging.config.dictConfig(
    {
        ""version"": 1,
        ""disable_existing_loggers"": False,
        ""filters"": {
            ""require_debug_false"": {""()"": ""django.utils.log.RequireDebugFalse""},
            ""require_debug_true"": {""()"": ""django.utils.log.RequireDebugTrue""},
        },
        ""formatters"": {
            ""django.server"": {
                ""()"": ""django.utils.log.ServerFormatter"",
                ""format"": ""[%(server_time)s] %(message)s"",
            }
        },
        ""handlers"": {
            ""nodebug_console"": {
                ""level"": ""WARNING"",
                ""filters"": [""require_debug_false""],
                ""class"": ""logging.StreamHandler"",
            },
            ""debug_console"": {
                ""level"": ""INFO"",
                ""filters"": [""require_debug_true""],
                ""class"": ""logging.StreamHandler"",
            },
            ""django.server"": {
                ""level"": ""INFO"",
                ""class"": ""logging.StreamHandler"",
                ""formatter"": ""django.server"",
            },
            ""mail_admins"": {
                ""level"": ""ERROR"",
                ""filters"": [""require_debug_false""],
                ""class"": ""django.utils.log.AdminEmailHandler"",
                ""email_backend"": DJANGO_EMAIL_ADMINS_BACKEND,
            },
        },
        ""loggers"": {
            ""django"": {
                ""handlers"": [""nodebug_console"", ""debug_console"", ""mail_admins""],
                ""level"": os.environ.get(""DJANGO_LOG_LEVEL"", ""INFO""),
            },
            ""django.server"": {
                ""handlers"": [""django.server""],
                ""level"": os.environ.get(""DJANGO_LOG_LEVEL"", ""INFO""),
                ""propagate"": False,
            },
            ""Wikilink"": {
                ""handlers"": [""nodebug_console"", ""debug_console"", ""mail_admins""],
                ""level"": os.environ.get(""DJANGO_LOG_LEVEL"", ""INFO""),
            },
        },
    }
)
}}}"	Bug	closed	Error reporting	3.1	Normal	fixed	settings, logging	Carlton Gibson	Ready for checkin	1	0	0	0	0	0
