Adding a CMS to Your Flask Web App Transcripts
Chapter: Routing for the CMS
Lecture: Concept: Adding the cms route
0:00 let's review taking arbitrary Earls and handling them with our flask app with the ultimate goal
0:07 of returning some as conceptual pages we've created and others just saying they don't exist.
0:13 So let's start with slash some slash arbitrary slash URL and we wanna handle this in
0:18 our sight. Remember, with the routing having just slash some variable is not enough that would just catch Well, some we need more than that.
0:27 So what we're gonna do is we're gonna create some kind of method, he recalled. It paid you could call it, see a mass request, whatever.
0:35 We're gonna give it a route, and the route is gonna have a variable full euro. That's what the angle brackets mean. But notice it has a constraint.
0:43 And unlike inner jersey or strings or something like that, this one is a path and path means something special to flask.
0:50 That means match everything with all the slashes and what not voidable to capture this request for slash some slash arbitrary slash.
0:59 Well, assuming they're not some other route in the system that's taking precedence over this so then we're gonna pass that into our method as a string.
1:09 We're gonna go to the database and say, Do you of a page for this Euro? Yes or no? If you do return it as we're showing here,
1:17 we'll have a simplified version on the screen. You know, I want to say, if you don't have it, you want to do a flask, not abort 404 and say No,
1:24 no, no, that's not found. I don't know what it is you're looking for, but we don't have one of those,
1:29 and that's it. This is really the entry point where we're going to get our CMS started in our flats cap,
1:36 and we're gonna expand and enhance it as we go.