Home > Net >  How can I pass a variable to a python flask app?
How can I pass a variable to a python flask app?

Time:10-17

How can I pass myvariable to the app in the below code? myvariable is a variable that comes from the rest of the code rather than being received from the URL.

@app.route("/myrout", methods=["GET"])

def myfunction(myvariable):

CodePudding user response:

global myvariable=8

@app.route("/myrout", methods=["GET"])
def myfunction():
    global myvariable
    local_variable=myvariable
  • Related