Hina Ch4n Hina Ch4n - 29 days ago 12
Python Question

Flask web developments passing multiple variables thru app.route

what im trying to do today is to pass multiple variables thru links to flask or just additional symbols followed by url
i have tried this

@app.route('/?action='+'<cmd>')


or

@app.route('/?<cmd>')


both give me a 404 error

but when i remove the "?" symbol it works fine.
Any ideas?

Answer

If you want to get query string parameter values the best way is to do this in your @app.route function. For example, getting the action query string parameter:

@app.route('/')
def index():
    action = request.args.get('action')