Responder Web Framework Mini-course Transcripts
Chapter: Building a RESTful API with Responder
Lecture: Serving static files

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Our template file is working but the static files are not there. Well, that's not surprising because we haven't created any.
0:07 There's a couple things we have to do. Notice already it's adding this static folder that's just by running it creates the templates
0:13 in the static folder. So we're going to copy some stuff over copy some CSS and so on and you'll see that those are actually being imported
0:20 right here at the top right there. So, I just got to make sure those are available. Now if we run this again click here, hey look at that.
0:28 It looks a lot better. Our formatting is here and of course we still have this view which you can look at it like this
0:34 go over to the network, go to requests you can see now we're getting good stuff for our static resources. Let's go see just CSS, there they are.
0:43 304 even they're cached, which is great. For this we don't have to do anything. The static folder is already mapped with caching
0:51 but if for some reason you wanted to control it I could go over here and say api.static_route then I could say /static
0:58 and potentially add additional details so if you wanted to have another static folder, other things and then come over here and say static=true.
1:07 Okay so you can add additional routes. I'll comment it out so you have it but it already creates one static folder for you to get started with.
1:14 It also does this templates thing which I've mapped as a template folder that's why it's purple here in PyCharm.
1:20 Okay it looks like this thing is up and running. We got our web view working great. How 'about this when we try to search
1:26 not found, not working so well, huh? All right well that's something we still got to build but we do have our static files working
1:33 and we have our template working right here.


Talk Python's Mastodon Michael Kennedy's Mastodon