Skip to content

Commit

Permalink
init 静态文件
Browse files Browse the repository at this point in the history
  • Loading branch information
liukai234 committed May 30, 2020
1 parent c190a05 commit f5278fe
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
18 changes: 17 additions & 1 deletion python_web/flasky/errorpages.py
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
# 自定义错误页面
# 自定义错误页面
# 404 客户端请求未知页面或路由
# 500 应用有未处理的异常

from flask import Flask
from flask import render_template
app=Flask(__name__)

@app.errorhandler(404)
def page_not_found(e):
return render_template('404.html'), 404

@app.errorhandler(500)
def internal_server_error(e):
return render_template('500.html'), 500

app.run(host='0.0.0.0', port=19722)
1 change: 1 addition & 0 deletions python_web/flasky/static.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# 静态文件
1 change: 1 addition & 0 deletions python_web/flasky/templates/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>Page Not Found</h1>
1 change: 1 addition & 0 deletions python_web/flasky/templates/500.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>Internal Server Error ! Error</h1>

0 comments on commit f5278fe

Please sign in to comment.