Python Flask Basics Templates and Static Files Static Files

css file is not reloading automatically

Every time i make a change in Css file the browser do not refresh the changes in css i have to manually refresh the stylesheet and then it renders the css on screen.

1 Answer

Brendon Butler
Brendon Butler
4,241 Points

There are a few solutions to this.

Bypass Cache Refresh - hard browser refresh, refreshes every bit of your website.

GET Attribute Method - basically all you do is add ?version=1 to the end of your css link in your HTML file. Every time you change your css file, increment the number by 1.

You can also add a "style" element to html and just add your CSS there. At least for testing purposes.