Python for the .NET Developer Transcripts
Chapter: Web frameworks
Lecture: Bring in the design

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Time to bring in our web design and to add another template and view method to get things to look a little bit nicer.
0:07 Now, this is not a web design course so I'm just going to grab our CSS, our images and this vendor is the snapshot in time
0:16 of a couple of things like Bootstrap. I'm going to drop that over into our static and just copy and paste
0:22 and it'll do all the right things to put them there, right adds them TicketHub and so on. And here's our guitars that we saw in the beginning.
0:29 But there's our static stuff. And I want to also copy over couple of templates here going to recreate the guitar one. But let's copy these two.
0:41 Now, notice we have an _layout. This might look familiar to you as well and then we have the index.
0:47 I saved the one we created under old just so you have it but now, we have a new one and it really has no dynamic data in it whatsoever.
0:55 It just has some styles, right? Like, here's that big, colorful section at the top. It's going to have some navigation.
1:03 The navigation comes from over here. And the way that you create these outer shell and then embedded, little pieces is We just have standard HTML.
1:11 This is the wrapper common look and feel. Here's our navigation. PyCharm thinks things are misspelled and, yet, they're not.
1:18 Then you just come down here and you say, we're going to have a block called main_content. So this line right here is going to inject
1:25 whatever is in these other template files into that segment assuming that we go up here and we say this template this one, this one extends _layout
1:36 and then here's a title section and here's the main bits, right? So this is how we break this up into a common look and feel
1:44 and then the things that's special per page. Let's run this again. Hit that. And look at this.
1:51 Pretty amazing, isn't it? I'll zoom it back a little bit so it fits on this screen. But there we have our cool web design for our project.
1:59 We've got our navigation and so on. Now, of course, if we click on Guitars /guitars doesn't exist. Maybe we misspelled it
2:07 or, more likely, maybe we haven't written it yet. Here's how we get this. You have to trust me that this is going to be
2:14 a common look and feel around the whole site but soon as we add another one, the Guitars one we'll see that that is, in fact, true.


Talk Python's Mastodon Michael Kennedy's Mastodon