falsk 请求没有返回值报错
生活随笔
收集整理的這篇文章主要介紹了
falsk 请求没有返回值报错
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
線上報警 5xx 錯誤,查看日志發(fā)現(xiàn)報這個錯,
TypeError: The view function did not return a valid response. The function either returned None or ended without a return statement.
這個方法沒有有效的返回結(jié)果
頁面報這個錯誤
Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
服務(wù)器遇到內(nèi)部錯誤,無法完成您的請求。服務(wù)器過載或應(yīng)用程序出錯。
?
代碼部分
1 # flask 請求不可以沒有返回值 2 # The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application. 3 import flask 4 5 from flask import Flask, request 6 7 app = Flask(__name__) 8 9 10 @app.route('/func') 11 # 展示數(shù)據(jù) 12 def func(): 13 return # 這塊有問題 14 # TypeError: The view function did not return a valid response. The function either returned None or ended without a return statement. 15 16 if __name__ == "__main__": 17 app.run(host='127.0.0.1',port='9090')修改方法,加個返回值就好了。
轉(zhuǎn)載于:https://www.cnblogs.com/wzbk/p/11011115.html
總結(jié)
以上是生活随笔為你收集整理的falsk 请求没有返回值报错的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 梦到摘青核桃是什么意思
- 下一篇: 提高redis cluster集群的安全