Getting detailed error reporting via e-mail

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.

Getting ready

Locate the Django project in your virtual environment.

How to do it...

The following procedure will help you send detailed e-mails about errors:

  1. Open the myproject_env/lib/python2.7/site-packages/django/utils/log.py file in a text editor and copy the DEFAULT_LOGGING dictionary to your project's settings as the LOGGING dictionary.
  2. Add the include_html setting to the mail_admins handler, as ...

Get Django: Web Development with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.