How to use a local variable in other functions flask? How to use a local variable in other functions flask? flask flask

How to use a local variable in other functions flask?


See the Flask session docs. You need to do some minor settings.

from flask import session@app.route('/')def home():   store = index_generator()   session['store'] = store   return render_template('home.html') @app.route('/home_city',methods = ['POST']) def home_city():   CITY=request.form['city']   store = session.get('store')   request_yelp(DEFAULT_LOCATION=CITY,data_store=store)   return render_template('bank.html')