#100DaysOfWeb in Python Transcripts
Chapter: Day 50: Responder framework
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
0:01 but the static files are not there.
0:03 Well, that's not surprising because we haven't created any.
0:06 There's a couple things we have to do.
0:07 Notice already it's adding this static folder
0:10 that's just by running it creates the templates
0:12 in the static folder.
0:13 So we're going to copy some stuff over
0:15 copy some CSS and so on
0:17 and you'll see that those are actually being imported
0:19 right here at the top right there.
0:21 So, I just got to make sure those are available.
0:23 Now if we run this again click here, hey look at that.
0:27 It looks a lot better. Our formatting is here
0:30 and of course we still have this view
0:32 which you can look at it like this
0:33 go over to the network, go to requests
0:35 you can see now we're getting good stuff
0:38 for our static resources.
0:40 Let's go see just CSS, there they are.
0:42 304 even they're cached, which is great.
0:45 For this we don't have to do anything.
0:47 The static folder is already mapped with caching
0:50 but if for some reason you wanted to control
0:53 it I could go over here and say api.static_route
0:56 then I could say /static
0:57 and potentially add additional details
0:59 so if you wanted to have another static folder, other things
1:02 and then come over here and say static=true.
1:06 Okay so you can add additional routes.
1:08 I'll comment it out so you have it
1:09 but it already creates one static folder
1:12 for you to get started with.
1:13 It also does this templates thing
1:15 which I've mapped as a template folder
1:17 that's why it's purple here in PyCharm.
1:19 Okay it looks like this thing is up and running.
1:22 We got our web view working great.
1:24 How 'about this when we try to search
1:25 not found, not working so well, huh?
1:28 All right well that's something we still got to build
1:30 but we do have our static files working
1:32 and we have our template working right here.