Django: Getting Started Transcripts
Chapter: Deploying Django Webapps
Lecture: Managing static files

Login or purchase this course to watch this video and the rest of the course contents.
0:00 So what you've learned from this is in addition to getting your Django code somewhere,
0:05 you're going to have to put the static files in a place where your web server can serve them.
0:09 There's a management command for that Django collect static. It's part of the static files framework and when run it will copy all of the
0:17 static files you've defined in your templates and directories into the appropriate production directory.
0:23 What does it mean to be defined as a static file? The static files dirs setting lists all of the places in your project.
0:30 The command should look for files if you're using the static tag in your templates, it is pointing to these same places
0:38 and where do all those files get copied to? Well, the static route defines where that is.
0:44 As long as you're setting points to the hosting directory where your web server expects these things, you're good.
0:49 Well that and you need to make sure you've got permission to write there when you run the command.
0:55 If you want to do something fancier the static files framework is plausible.
0:59 Django comes with a file based one that you've used in your code but there are
1:03 also third party modules that allow you to use S3 or similar services as a back end instead.
1:10 And of course if you really want to, it is yet another thing you could write yourself.


Talk Python's Mastodon Michael Kennedy's Mastodon