From the course: Flask Essential Training (2019)
Unlock the full course today
Join today to access over 24,100 courses taught by industry experts.
Displaying custom error pages
From the course: Flask Essential Training (2019)
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Using redirect and url_for for error handling3m 41s
-
(Locked)
Saving to a JSON file5m 6s
-
(Locked)
Parsing a JSON file for conflicting entries3m 11s
-
(Locked)
Alerting users with message flashing5m 26s
-
(Locked)
File uploads from users8m 17s
-
(Locked)
Variable rules in URLs5m 39s
-
(Locked)
Working with static files4m 19s
-
(Locked)
Displaying custom error pages5m 49s
-
(Locked)
-
-
-