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.
Alerting users with message flashing
From the course: Flask Essential Training
Alerting users with message flashing
- [Announcer] We've written the code. So if someone uses a short name that's already been taken, like in this case with go and they hit the shorten button, it still keeps them on the homepage and clears the data. Now, this is the correct move to take. But the user is left really confused. They think, I just put in a URL, I put in a short name. What's wrong, did it make it? Did something go wrong? They don't really know. So this would be a great opportunity to display some sort of message to the user to say, hey, that's already been taken, you need to pick a new short name for your URL. So this is a great chance to introduce flash inside of flask. It's a great way to display messages or information to your users as you move on to new web pages. So let's move back to our app.py. And this is a new flask skill that we're importing. So let's go to our import line and add flash right up at the top. And then let's move down…
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)
-
-
-