My function calls Matplotlib to create and save a figure based on dates from user's input.
I save a new figure in my static folder like this:
plt.savefig('insights/static/chart.png')
return render_template("chart.html")
My template calls the figure like this:
<img src="/static/chart.png">
When the user enters new dates Matplotlib creates a new figure that overrides the existing figure file in static. The figure on the server is updated but the image displayed in my template is not. To update the new figure I need to save the template.
I think I have a problem with caching... Could anyone suggest a workaround?