如何将变量传递给 python flask 应用程序?
How can I pass a variable to a python flask app?
如何在下面的代码中将 myvariable
传递给 app
? myvariable
是来自代码其余部分的变量,而不是从 URL.
中接收的变量
@app.route("/myrout", methods=["GET"])
def myfunction(myvariable):
global myvariable=8
@app.route("/myrout", methods=["GET"])
def myfunction():
global myvariable
local_variable=myvariable
如何在下面的代码中将 myvariable
传递给 app
? myvariable
是来自代码其余部分的变量,而不是从 URL.
@app.route("/myrout", methods=["GET"])
def myfunction(myvariable):
global myvariable=8
@app.route("/myrout", methods=["GET"])
def myfunction():
global myvariable
local_variable=myvariable