【app.py】添加路由拦截器:错误路径跳转404
This commit is contained in:
@@ -6,5 +6,9 @@ app = Flask(__name__)
|
|||||||
def hello_world(): # put application's code here
|
def hello_world(): # put application's code here
|
||||||
return session.clear()
|
return session.clear()
|
||||||
|
|
||||||
|
@app.route('/<path:path>')
|
||||||
|
def catch_all(path):
|
||||||
|
return render_template('404.html')
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run()
|
app.run()
|
||||||
Reference in New Issue
Block a user