from flask import jsonify, render_template from app.extensions import db from . import bp @bp.get("/") def index(): return render_template("core/index.html") @bp.get("/health") def health(): return jsonify(status="ok") @bp.app_errorhandler(403) def forbidden(_error): return render_template("core/403.html"), 403 @bp.app_errorhandler(404) def not_found(_error): return render_template( "core/error.html", heading="That page is not here", message="The address may have changed, or the item may be unavailable.", ), 404 @bp.app_errorhandler(413) def request_too_large(_error): return render_template( "core/error.html", heading="That file is too large", message="Choose a file smaller than 2 MiB and try again.", ), 413 @bp.app_errorhandler(500) def internal_error(_error): db.session.rollback() return render_template( "core/error.html", heading="Steady needs a moment", message="Nothing more is required from you. Please try again shortly.", ), 500