From the course: Flask Essential Training

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Working with static files

Working with static files

From the course: Flask Essential Training

Start my 1-month free trial

Working with static files

- [Instructor] So currently, we have the functionality so that if someone provides a short name, they can get back a URL, if that's what they provided. Now, if they provided a file, well, we don't have that functionality yet. And the reason is we don't know how to serve static files. But let's talk about how we can do that in Flask. So there's a couple of steps here. The first one is we have to create a directory in our project called static. So I'm going to right click here and do new folder. I'm going to name this static, this is a special name that Flask is going to look for whenever you have static files, and any static files that you have, they might be things like JavaScript from your website, you might have CSS, maybe a logo for your website, those are all going to go inside of the static folder. I want to make sure that there's a spot specifically for our users content, things that they have uploaded to us. So inside…

Contents