@app.route('/bInfo', methods = ['POST', 'GET'])
def create():
result = []
....
return jsonify(result)我想向'/bInfo‘提出一个请求
@app.route('/')
def index():
js = request.json('/bInfo') #this is not working
print(js)
return render_template('index.html')我怎么能这么做?
发布于 2022-04-15 10:14:33
无论如何,您可以执行以下操作之一:
/bInfo 1.重构在路由本身之外获取的内容。
这基本上是不言自明的。您只需将内容移出外部的代码,并在这两条路径中调用它。
使用requests.get() 从 请求 请求所需的页面,并使用.
您需要从localhost请求,这将使一个路由依赖于另一个路由。备选案文1要安全得多。
https://stackoverflow.com/questions/71882670
复制相似问题