'Flask app not updating the page on reloading after being deployed on heroku
So I have made a pretty basic flask app which shows a plotly graph template. The code pulls data from a database and updates the template, which should be reflected on the app when I reload. It works like a charm locally but when I push it on heroku, it doesn't seem to work at all. I'm not able to understand the issue here. I'll attach the code below.
app = flask.Flask(__name__)
def dir_last_updated(folder):
return str(max(os.path.getmtime(os.path.join(root_path, f))
for root_path, dirs, files in os.walk(folder)
for f in files))
@app.route("/")
def totalNodeCount():
plot = gp.Plot()
plot.plotData() #Fetches data from a database and updated the testTemplate.html
return render_template("testTemplate.html", last_updated = dir_last_updated("templates"))
if __name__=="__main__":
app.config['TEMPLATES_AUTO_RELOAD'] = True
app.run(host = "0.0.0.0", port = 8080)
Any help would be highly appreciated :) Thanks.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
