urilist = ["/log", "/login", "/loginexample"]
@app.route('/<urllist>', methods=['GET'])
def main(urllist):
if "/{}".format(urllist) in urilist:
return 'Hello World!'
return flask.render_template("error.html")#or whatever else you would do if urllist is not in urilist
您可以将参数从路由传递到函数,并检查列表中是否存在该参数:
相关问题 更多 >
编程相关推荐