本文介绍了Flask approute中有多个参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在URL调用中有多个参数,如何写烧瓶approute。这是我从AJAX调用的URL

  http://0.0.0.0:8888/createcm?summary=VVV&change = Feauure 

我试图写我的烧瓶Approute这样。

  @ app.route('/ test /< summary,change>,methods = ['GET'] 

但是这不起作用,任何人都可以建议我如何提及aproute? b

解决方案

路由不匹配直接传递给您的方法的查询字符串。

<$ p $ ($'$')

@ app.route('/ createcm',methods = ['GET'])
def foo():
打印request.args.get('summary')
打印request.args.get('change')


How to write the flask approute if i have multiple parameters in the URL call. Here is my URL i am calling from AJax

            http://0.0.0.0:8888/createcm?summary=VVV&change=Feauure

i was trying to write my flask approute like this.

                @app.route('/test/<summary,change> ,methods=['GET']

But this is not working. Can any one suggest me how to mention the aproute?

解决方案

Routes do not match a query string, which is passed to your method directly.

from flask import request

@app.route('/createcm', methods=['GET'])
def foo():
   print request.args.get('summary')
   print request.args.get('change')

这篇关于Flask approute中有多个参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-14 21:25