You use the logging settings to mail 500 errors to the admin email ids.
Example of a logging setup :
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'mail_admins': {
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler',
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
}
}
}
This will mail all 500 errors in django to the mentioned email ids.
See:
Elegant setup of Python logging in Django
and :
https://docs.djangoproject.com/en/dev/topics/logging/#an-example
If you want to use another SMTP server, then use exception middleware .
http://docs.djangoproject.com/en/dev/topics/http/middleware/#process-exception
in the process_exception
method, you can email the traceback of exception to required
email accounts.