戒酒的李白

【app.py】添加路由拦截器:错误路径跳转404

Showing 1 changed file with 4 additions and 0 deletions
... ... @@ -6,5 +6,9 @@ app = Flask(__name__)
def hello_world(): # put application's code here
return session.clear()
@app.route('/<path:path>')
def catch_all(path):
return render_template('404.html')
if __name__ == '__main__':
app.run()
\ No newline at end of file
... ...