i code:
def error_handler_register(app: BustAPI):
@app.errorhandler(404)
def page_not_found():
return render_template('err.html', **{'status_code': 404, 'message': 'Page not found'})
@app.errorhandler(401)
def unauthorized():
return render_template('err.html', **{'status_code': 401, 'message': 'Unauthorized'})
@app.errorhandler(403)
def forbidden():
return render_template('err.html', **{'status_code': 403, 'message': 'Forbidden'})
@app.errorhandler(500)
def server_error():
return render_template('err.html', **{'status_code': 500, 'message': 'Server Error, contact the administrator'})
app = BustAPI()
error_handler_register(app)
but when call a non-exist route e.g 'http://127.0.0.1:5000/x/y/z', it just show a string 'Not found' in the upper left corner of the browser window,not rendering the HTML file 'err.html',it show text in the middle of the browser window.
i code:
but when call a non-exist route e.g 'http://127.0.0.1:5000/x/y/z', it just show a string 'Not found' in the upper left corner of the browser window,not rendering the HTML file 'err.html',it show text in the middle of the browser window.