This question is probably a duplicated question and sorry about that.
I'm using Django 1.4.1
and on production server I set DEBUG
to False
.
Sometimes users get an Exception and server shows 500.html
template but don't send an email configured in ADMINS
section of settings.py
.
In application sending email is properly configured because under registration process I can receive Welcome Email.
Fragment of my settings.py
:
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('example', '[email protected]'), # this changed but my email is correct
)
MANAGERS = ADMINS
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
'django.middleware.transaction.TransactionMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}
This has been driving me mad for a while now. JUST figured it out:
ADMINS = (
('Your Name', '[email protected]'),
*****
)
That comma at the end was all I forgot and it was enough to break it. Thought I'd share it so some other poor idiot like me can save himself some precious hair that he might otherwise have pulled out...
Did you set SERVER_EMAIL in settings. Thats the from address used to send out error mails. Default is root@localhost which might be getting blocked at SMTP. Might want to set it the same as DEFAULT_FROM_EMAIL
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With