Sending error responses (Simple)
In this section, we will send an error page to the user with style.
We are working from the
app.py file inside the
sched directory of our project, and in the
templates directory inside
sched. Create a directory named
error inside the
- When the user hits a Not Found page, we want to display a page that will direct them back to the appointment list. You can tell Flask how to render responses for error cases, typically for HTTP error codes. We will provide a custom 404 Not Found page as shown in the following screenshot:
- Flask provides
app.errorhandler to tell Flask how to ...