16
Tôi có chế độ xem gọi một hàm để nhận phản hồi. Tuy nhiên, nó đưa ra lỗi View function did not return a response
. Làm thế nào để sửa lỗi này?Lỗi trả về chế độ xem bình "Chức năng chế độ xem không trả về phản hồi"
from flask import Flask
app = Flask(__name__)
def hello_world():
return 'test'
@app.route('/hello', methods=['GET', 'POST'])
def hello():
hello_world()
if __name__ == '__main__':
app.run(debug=True)
Khi tôi thử kiểm tra bằng cách thêm giá trị tĩnh thay vì gọi hàm, nó hoạt động.
@app.route('/hello', methods=['GET', 'POST'])
def hello():
return "test"