I have a single png file in my static folder that I update from each run and each time it is updated, it shows up in my webpage. However, no matter how many times I edit the png file, the edited version does not display on my webpage, and some older version does.
I have researched that this is a cache issue, but I cannot figure out how to empty the cache just of one png file.
It's driving me crazy.
Function that saves png file to static folder:
def plot_df(df, x, y, title="", xlabel='Date', ylabel='Tweets per date'):
plt.figure()
plt.bar(x, y)
plt.gca().set(title=title, xlabel=xlabel, ylabel=ylabel)
plt.savefig('static/timeseries.png')
Accessing that file in html:
<h2 style="margin-top: 80px; margin-bottom: 20px; text-align: center;"><b>Time Series</b></h2>
<div style="text-align: center;">
<img src="{{ url_for('static', filename='timeseries.png') }}" alt="" width="1000" height="700" style="border-radius: 20px; margin-bottom: 140px;">
</div>
question from:https://stackoverflow.com/questions/65661801/how-to-uncache-static-png-after-every-flask-run