It is a good idea to receive notifications when something unexpected happens with the application. Setting this up is pretty easy and adds a lot of convenience to the process of error handling.
Sending emails on the occurrence of errors
Getting ready
We will take the application from the last recipe and add mail_handler to it to make our application send emails when an error occurs. Also, we will demonstrate the email setup using Gmail as the SMTP server.
How to do it...
First, add the handler to the configuration in my_app/__init__.py. This is similar to how we added...