Building Data-Driven Web Apps with Pyramid and SQLAlchemy Transcripts
Chapter: Routing and URLs
Lecture: Packaging routes and views

Login or purchase this course to watch this video and the rest of the course contents.
0:00 So let's round out the rest of the URL structure
0:02 we're going to use for our site.
0:04 So we're going to have a few more things that we'd like to do.
0:06 We've saw that we've got our home stuff
0:08 we got some packaged things.
0:09 We actually want a few more things going on here
0:11 in the package world.
0:13 We want a URL that looks like this.
0:16 So, we're going to go /projects/SQLAlchemy/releases.
0:20 and that will show all the various releases.
0:24 We also want one like this.
0:27 It's starting to stretch a little off the screen
0:29 with this tiny resolution I have for recording.
0:32 This is not correct.
0:33 But we're going to go to the project.
0:35 Specify the project like SQLAlchemy
0:36 and then get the releases, and get the details
0:38 for a particular one, so like, /releases/117.
0:43 This one will list them all.
0:44 We interact with one, this is going to be the details.
0:47 So let's go over here.
0:49 Let's call this releases.
0:51 And I'll keep with my little example
0:53 of having the slash on
0:56 and not on on the end there.
0:58 Maybe put a space to show the grouping.
1:01 Actually, this one we'll just call release version.
1:05 Right, there's only going to be one.
1:08 Okay, all that has to do with PackageController.
1:10 Let's go add these releases here.
1:14 This URL. So, and the PackagesController.
1:17 We're going to need something again, like this.
1:20 And sometimes it's handy to have a URL structure up there
1:25 to remind you what's coming in.
1:31 I guess I'll stick with that for now.
1:32 So we could put this here. Total cleanup.
1:35 So the name, kind of remember these releases
1:38 have to match exactly, so let's put releases.
1:43 Again with a slash, and then the fully
1:47 Again we're going to get the package name
1:49 and we're going to pass it on to the view.
1:51 But we're also going to have to pass the releases.
1:53 We'll do that later. Let's remind ourself.
1:56 Something like the releases are going to be some kind of list.
1:59 Maybe like this.
2:05 So we'll just say releases there.
2:08 Again we have this release version one.
2:10 So let's go put, that'll be our final details.
2:14 We're only going to need one of those.
2:18 So we have release version, and also let's copy the URL
2:21 so we remember the data that we have to work with.
2:27 So we're going to have package name and a release version.
2:32 Let's go ahead and grab that data like so.
2:35 Over package name and the release version.
2:38 Let's name this is the same here.
2:43 And there for now.
2:48 Okay, so this is all looking really good.
2:50 Let's just make sure that it works.
2:55 So we've got Pyramid, should still work.
2:58 And we should have releases, which is going to say
3:00 "Here are the releases."
3:02 And then again, one, two, three.
3:06 There's our details for that particular release.
3:08 Okay, it looks like that routing is all in place.