To perform system logging, Django uses Python's built-in logging module. The default Django configuration seems to be quite complex. In this recipe, you will learn how to tweak it in order to send error e-mails with complete HTML, similar to what is provided by Django in the DEBUG mode when an error happens.
The following procedure will help you send detailed e-mails about errors:
Open the
myproject_env/lib/python2.7/site-packages/django/utils/log.py
file in a text editor and copy theDEFAULT_LOGGING
dictionary to your project's settings as theLOGGING
dictionary.Add the
include_html
setting to themail_admins
handler, as follows:# myproject/conf/base.py or myproject/settings.py LOGGING = { "version": 1, "disable_existing_loggers": False, "filters": { "require_debug_false": { "()": "django.utils.log.RequireDebugFalse", }, ...