0

I have a page built with Flask that displays four images saved locally from another API I have written. From the webpage you can send commands to the API, which generates new images that overwrites and replaces the previous images at the same path. On some computers and browser, this works perfectly and on others the new images does not load to to caching. Since the whole point of the page is that it's dynamically changing all the time, it would not be an issue to disable caching all together, but I can't get it to work. I've tried putting the following code at the top of the HTML file but it still doesn't work, even when accessing it on a new browser and computer that never have visited the site.

{% extends 'base.html' %}
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<head>
...

Since the API changes the images locally and I don't have them as a response, I can't add headers to the images and neither can I add a version/date to the url since I am using Flask's built in url_for and send_from_directory to get the images.

1 Answers1

1

I found that just adding SEND_FILE_MAX_AGE_DEFAULT = 0 to my app config fixed everything. Something to do with Flask saving static-files on its own and not updating it (Disabling caching in Flask).