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.
Variable rules in URLs
- [Instructor] Now, when people have come to visit our website, they've made lots of different short codes with urls and files that they want associated with them. For instance, we have go connected with yahoo dot com. Hello with google dot com. And even if we go to the right here, we can see the house that we just created, which is now associated with a file. So, we have to have the ability so that when someone visits our website slash house, that we display the following file or if they visit our site slash go, it will redirect them to yahoo dot com. So, how do we do this? Well, we need a new route to find these situations when someone has specified these unique urls. And if we go to our app dot py, and we look at the existing routes that we have, we could create a new route that would look, for instance, something like go or house. But, how would we know possibly what someone is going to upload to our site?…
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)
-
-
-