Building Data-Driven Web Apps with Pyramid and SQLAlchemy Transcripts
Chapter: Routing and URLs
Lecture: Packaging routes and views
0:00 So let's round out the rest of the URL structure we're going to use for our site. So we're going to have a few more things that we'd like to do.
0:07 We've saw that we've got our home stuff we got some packaged things. We actually want a few more things going on here in the package world.
0:14 We want a URL that looks like this. So, we're going to go /projects/SQLAlchemy/releases. and that will show all the various releases.
0:25 We also want one like this. It's starting to stretch a little off the screen with this tiny resolution I have for recording. This is not correct.
0:34 But we're going to go to the project. Specify the project like SQLAlchemy and then get the releases, and get the details
0:39 for a particular one, so like, /releases/117. This one will list them all. We interact with one, this is going to be the details.
0:48 So let's go over here. Let's call this releases. And I'll keep with my little example of having the slash on and not on on the end there.
0:59 Maybe put a space to show the grouping. Actually, this one we'll just call release version. Right, there's only going to be one.
1:09 Okay, all that has to do with PackageController. Let's go add these releases here. This URL. So, and the PackagesController.
1:18 We're going to need something again, like this. And sometimes it's handy to have a URL structure up there to remind you what's coming in.
1:32 I guess I'll stick with that for now. So we could put this here. Total cleanup. So the name, kind of remember these releases
1:39 have to match exactly, so let's put releases. Again with a slash, and then the fully releases.pt. Again we're going to get the package name
1:50 and we're going to pass it on to the view. But we're also going to have to pass the releases. We'll do that later. Let's remind ourself.
1:57 Something like the releases are going to be some kind of list. Maybe like this. So we'll just say releases there.
2:09 Again we have this release version one. So let's go put, that'll be our final details. We're only going to need one of those.
2:19 So we have release version, and also let's copy the URL so we remember the data that we have to work with.
2:28 So we're going to have package name and a release version. Let's go ahead and grab that data like so. Over package name and the release version.
2:39 Let's name this is the same here. And there for now. Okay, so this is all looking really good. Let's just make sure that it works.
2:56 So we've got Pyramid, should still work. And we should have releases, which is going to say "Here are the releases." And then again, one, two, three.
3:07 There's our details for that particular release. Okay, it looks like that routing is all in place.