Django logging: change the sender email address from root @ localhost to something else

In my settings.py I have the following logging configurator. If there is an error, I get an email from root @ localhost. My problem is that I have multiple projects and want all error messages to be sent to the same email. But now it's very annoying to figure out where the error occurred, so I want to replace the senders' email address from root @localhost to something like error@project-site.tld. Is it possible to create virtual mailboxes?

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'handlers': {
        'mail_admins': {
            'level': 'DEBUG',
            'class': 'django.utils.log.AdminEmailHandler'
        },
    'logfile': {
        'class': 'logging.handlers.WatchedFileHandler',
        'filename': '/var/log/django/proj_name.log'
        },
    },
'loggers': {
    'django.request': {
        'handlers': ['mail_admins'],
        'level': 'DEBUG',
        'propagate': True,
        },
    'django': {
        'handlers': ['logfile'],
        'level': 'DEBUG',
        'propagate': False,
        },
    }
}

      

+3


source to share


1 answer


mail_admins uses SERVER_EMAIL parameter



+7


source







All Articles