This course will be retired on August 2, 2021. We recommend "A Social Network with Flask" for up-to-date content.
Handling 404s5:40 with Kenneth Love
Eventually, someone is going to type in a URL that doesn't exist, or a link is going to expire. Flask can handle these on its own, but it's nice to provide a custom error page. Let's see how to do that.
abort()- Function to immediately end a request with a specified status code.
errorhandler()- Decorator that marks a function as handling a certain status code.
return render_template('template.html'), 404- The
404on the end specifies the status code for the response.
You need to sign up for Treehouse in order to download course files.Sign up