I made a change on one of the .js
files that I use and no matter what I do, flask insists on picking up, from memory cache, the last version of the file, without the change.
To clarify, I have the following structure. It all starts with foo.html
return render_template foo.html
foo.html
has a form inside that calls flask with some data and then returns a second template bar.html
:
return render_template bar.html
This second template calls some .js
file, placed in the static
folder, but it doesn't update when the code changes.
I mention the structure above because if the .js
file was placed on foo.html
instead of bar.html
then Flask would pick up the new changes on the file. But in bar.html
Flask completely ignores them.
What is happening?
The only thing that worked was to click on "disable cache" on the browser and reload again.
"script.js?some_variable=dynamic_value"
.dynamic_value
can be version number or date of file. – Vannycustom.js
usecustom.1.2.js
– Venge.js
file, surely one cannot be expected to rename the files with every single change. – DiahannCtrl+F5
orCtrl+R
doesn't work then disable cache in browser till you create final version or use"script.js?some_variable=file_timestamp"
and add create function to generat url with parameter. – Vanny