Serving static files
Flask will automatically serve up files from our /static/ directory. When we deploy our site in Chapter 10, Deploying Your Application, we will use the Nginx web server to serve static assets but, for local development, Flask makes things really easy.
In addition to our image uploads, let's also serve our site's JavaScript and stylesheets from /static/. Download jQuery and Bootstrap and place the JavaScript files (jquery-<version>.min.js and boostrap.min.js) in static/js. Place the minified bootstrap CSS file (bootstrap.min.css) in static/css. Bootstrap also comes with some special fonts that are used for icons. Copy the bootstrap fonts directory into the static directory as well. You should now have four directories inside ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access