From the course: Flask Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Displaying custom error pages

Displaying custom error pages

From the course: Flask Essential Training

Start my 1-month free trial

Displaying custom error pages

- [Narrator] So our URL Shortener is able to give back files or URLs for names that people have submitted. Well, let's say that someone submits a name that we don't have something for. I'm just going to type some gibberish here. If I hit Enter on this, well we get a really nasty looking error, which really isn't something we should be sending back to the user. We want to have a more clean page that says "This was not found," or something like that, and specifically for this case, we want to use something called a 404 page. You may have seen that on other websites. 404 means we couldn't find what it is that you were looking for. So if we go ahead and move back to our app.pie, in order to do this we need to bring in some new code from Flask, so we're going to add more to our import line here. We are going to add "abort", and this abort allows us to, when something goes wrong, send a special error message depending on what…

Contents