Error handling and custom error pages
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
20
app/app.py
20
app/app.py
@@ -46,7 +46,25 @@ def load_user(user_id):
|
||||
# Context processor injects current version and commit
|
||||
@app.context_processor
|
||||
def injectVerCommit():
|
||||
return dict(currVersion=currVersion, currCommit=currCommit)
|
||||
return dict(currVersion=currVersion, currCommit=currCommit, datetime=datetime, ZoneInfo=ZoneInfo)
|
||||
|
||||
# Error handling
|
||||
# Pass env variables for debugging in prod
|
||||
NODE_NAME = os.environ['NODE_NAME']
|
||||
POD_NAME = os.environ['POD_NAME']
|
||||
|
||||
# Error Routes
|
||||
@app.errorhandler(404)
|
||||
def notFound(e):
|
||||
return render_template('errors/404.html', NODE_NAME=NODE_NAME, POD_NAME=POD_NAME), 404
|
||||
|
||||
@app.errorhandler(403)
|
||||
def forbidden(e):
|
||||
return render_template('errors/403.html', NODE_NAME=NODE_NAME, POD_NAME=POD_NAME), 403
|
||||
|
||||
@app.errorhandler(500)
|
||||
def ISEerror(e):
|
||||
return render_template('errors/500.html', NODE_NAME=NODE_NAME, POD_NAME=POD_NAME), 500
|
||||
|
||||
# Index route
|
||||
@app.route('/')
|
||||
|
Reference in New Issue
Block a user