...

/

How Do We Serve Static Files?

How Do We Serve Static Files?

In this lesson, we will study how we can host the static files present in our Flask application.

What are static files?

Static files, or assets, are the files that the server sends to the clients “as-it-is”, i.e., without any intervention. For example, any CSS files, background images, or JavaScript files that we might have on our website are sent to the client without modification.

Steps to Serve Static Files

The following steps need to be taken to host a static asset.

Create a \static directory

First, similar to the templates, we need to create a directory called \static in our project for Flask to ...