Error Pages and Debugging Tools
Any exception raised by a request handler (or a request filter for that matter) is by default caught by the error_filter. This filter is responsible for turning HTTP exceptions such as redirects into the appropriate HTTP response.
Exceptions that are not instances of the HTTPException class are treated as internal errors and result in a 500 Internal Server Error HTTP response.
Error Page Templates
For any HTTP exception associated with a status code greater than or equal to 400 (Bad Request), the error handling request filter will render a template named error/%(status_code)d.html, if such a template is found, or the generic error.html otherwise.
For example, to customize the error page for 404 Not Found errors, you'd create a error/404.html template in your templates directory.
The template is passed the exception value under the name “error”, so that it can show details about the error when appropriate.
Error Email Notification
If an SMTP server and email address are configured, email notifications (in plain text format) are sent out on internal errors. The emails include the requested URL, various other information, and a traceback.
Developer Error Page
If the configuration options debug is enabled, any errors that would normally result in the display of an error page instead result in the display of a developer-oriented page showing details about the error. That page will show information about which Python packages (and their versions) are in use, a fancy traceback, and it will let you drill down into the locals of each frame in the traceback.
Inspecting Template Data
If the debug option is enabled, you will be able to inspect the template data and system information for any page simply by adding the debug parameter to the query string (the value of the parameter is ignored, only its presence is checked).