I am trying to create a web page where the user inputs info, submits it, and then a chart based on the submitted info shows up on the web page. My issue is that the chart image that is displayed does not update, and just stays static, even after the user info changes.
To save the chart, I use:
plt.savefig('images/chart.png')
The Flask portion of the code is:
app = Flask(__name__, static_url_path = "", static_folder = "")
@app.route('/', methods=['GET', 'POST'])
def chart():
if request.method == "POST":
req = request.form
...
return render_template('index.html')
if __name__ == "__main__":
app.run()
An in index.html:
<img src="{{ url_for('static', filename = '/images/chart.png') }}">
If I go to the location where the image is being saved, I see the new chart, but on the webpage, nothing changes.