记一次flask项目开发中遇到的无脑问题。
TypeError: The view function did not return a valid response. The function either returned None
#错误的原因是,代码中缺少return
@app.route('/history_ocr/', methods=['GET', 'POST'])
def history_ocr():
if request.method == 'GET':
result = operate_database.searchresult(session.get('username'))
render_template('history.html',
result=result)
修改后
@app.route('/history_ocr/', methods=['GET', 'POST'])
def history_ocr():
if request.method == 'GET':
result = operate_database.searchresult(session.get('username'))
# print(result[0])
# print(len(result))
return render_template('history.html',
result=result)
就没问题了。