Passing variables through URL to a flask app

后端 未结 2 1971
执笔经年
执笔经年 2020-12-19 12:58

Well i\'ve this in my flask app :

@app.route(\"/changeip/\")
def change_ip(ip) :
    return ip

Now if i invoke it like :

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-19 13:36

    You should use:

    app.route('/something/')
    def function(ip):
    

    And when you are using url_for, you should pass value of ip aswell:

    url_for('function', ip='your_ip_address')
    

提交回复
热议问题