finish custom errors page

This commit is contained in:
xpleaf
2016-03-05 22:37:59 +08:00
parent e9019bc977
commit 4cc52c7a47
6 changed files with 48 additions and 1 deletions
+1 -1
View File
@@ -2,4 +2,4 @@ from flask import Blueprint
main = Blueprint('main', __name__)
from . import views
from . import views, errors
+20
View File
@@ -0,0 +1,20 @@
from flask import render_template, request, jsonify
from . import main
@main.app_errorhandler(403)
def forbidden(e):
return render_template('403.html'), 403
@main.app_errorhandler(404)
def page_not_found(e):
return render_template('404.html'), 404
@main.app_errorhandler(500)
def internal_server_error(e):
return render_template('500.html'), 500
+9
View File
@@ -0,0 +1,9 @@
{% extends "base.html" %}
{% block title %}Blog_mini -禁止访问{% endblock %}
{% block content %}
<div class="page-header">
<h1>亲,您没有访问的权限哦!</h1>
</div>
{% endblock %}
+9
View File
@@ -0,0 +1,9 @@
{% extends "base.html" %}
{% block title %}Blog_mini -无法找到该页面{% endblock %}
{% block content %}
<div class="page-header">
<h1>嘿嘿,您要找的页面不存在哦!</h1>
</div>
{% endblock %}
+9
View File
@@ -0,0 +1,9 @@
{% extends "base.html" %}
{% block title %}Blog_mini -服务器内部问题{% endblock %}
{% block content %}
<div class="page-header">
<h1>不好意思哦,我出现了点小问题哦!</h1>
</div>
{% endblock %}
BIN
View File
Binary file not shown.