1

I would like to start Flask app with empty dictionary which later is populated by users, however, when I initialize it like this:

@app.route("/")                                                       
def index():
    highscore = {}
    session["highscore"] = highscore
    return render_template("index.html", user = "", highscore = highscore)

it resets to empty whenever user goes back to or enters index.html. Can I initialize dictionary somewhere else and only once app is deployed?

  • Are you looking for a quick-and-dirty way towards an in-memory data store during the prototype stage of your app? That was my take on your question. – Zach Valenta Dec 16 '18 at 14:14

0 Answers0