Using variables across Flask routes [duplicate]
问题 This question already has answers here : Are global variables thread safe in flask? How do I share data between requests? (2 answers) Closed last year . I am learning Flask and have a question regarding use of variables in the context of routes.For Example, my app.py: from flask import Flask, render_template app = Flask(__name__) @app.route("/index") def index(): a=3 b=4 c=a+b return render_template('index.html',c=c) @app.route("/dif") def dif(): d=c+a return render_template('dif.html',d=d)