![](/img/trans.png)
[英]Python Flask: API call not happening, resulting in 500 internal server error
[英]Flashing 500 Internal Server Error to screen Flask with Python
一个简单的问题,我希望...开发过程中出现500个内部错误,并希望将它们刷新到浏览器屏幕上,以便更轻松地处理时间。 用Flask和Python做到这一点的最简单方法是什么? 谢谢。
在flask jinja模板中编写custome错误页面,并在屏幕上显示您要闪烁的方式
from flask import render_template
@app.errorhandler(500)
def page_not_found(e):
return render_template('500.html'), 404
#An example template might be this for your 5000.html, you can write
#your own through this code:
{% extends "layout.html" %}
{% block title %}Page Not Found{% endblock %}
{% block body %}
<h1>Page Not Found</h1>
<p>What you were looking for is just not there.
<p><a href="{{ url_for('index') }}">go somewhere nice</a>
{% endblock %}
500表示您的演示中出了点问题。也可能会显示错误消息
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.