Using stylesheets, images and scripts will improve the appearance and experience of your app greatly.
Place these files inside a folder named: static. Then simply reference the files’ locations in your templates
The app directory should look something like this:
my_app.py [templates] |__ add.html |__ index.html |__ layout.html [static] |__ scripts.js |__ styles.css
App Files Update
styles.css
body { background: beige; color: #333; }
scripts.js
alert("Welcome!");
layout.html
... <link href="/static/styles.css" type="text/css" rel="stylesheet"> ... {% block scripts %} {% endblock %} </body> </html>
index.html
{% block scripts %}
<script src="/static/scripts.js"></script>
{% endblock %}