您知道如何从服务器Flask向客户端发送响应吗?
我不知道该怎么办,这给我带来了一些问题:
在下面的代码中,我想在收到一些信息(文档类型)后更新页面,但是渲染模板功能似乎无法正常工作,因为客户端没有收到答案。
@app.route('/createdocument', methods=['POST', 'GET'])
#@login_required
def create_document():
if request.method == "POST":
request_parameter = request.form.to_dict()
if is_type_of_document(request_parameter):
print("request type of document")
dico = request.form.to_dict()
liste = return_tracks_by_genre(get_tracks(), dico['category'])
return render_template("tools/createdocument.html", received_category=True, category=dico['category'])
else:
print("other request")
clicked = request.json['data']
return render_template("tools/createdocument.html", received_genre=False)
您知道如何发送对请求的响应吗?