[英]"return render_template()" doesn't work [XMLHttpRequest() & flask]
[英]Python Flask doesn't serve custom 500 template/return on IIS
我在 IIS 上使用 Flask 和藍圖。 我的問題是,當觸發 500 錯誤時,它會加載默認的 IIS 500 模板,而不是我想要的。
我已經嘗試了幾件事,這就是我所在的地方。 我有以下代碼
from flask import render_template,Blueprint
errorbp = Blueprint("errorbp",__name__)
@errorbp.app_errorhandler(404)
def page_not_found(e):
return "404", 404
@errorbp.app_errorhandler(500)
def internal_server_error(e):
return "500", 500
如果我訪問一個不存在的頁面,我會按預期返回“404”。 如果我故意創建錯誤,我會得到以下信息
關於做什么的任何建議? 我想我現在可能需要對 IIS 做點什么,但是什么? 我已經編輯/刪除了 5xx 狀態代碼/頁面,但仍然沒有
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.