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 ...

Get Learning Flask Framework now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.