Flask Error page
examples/flask/500/app.py
from flask import Flask app = Flask(__name__) @app.route("/") def main(): return ''' Main <a href="/bad">bad</a> ''' @app.route("/bad") def bad(): raise Exception("This is a bad page") return 'Bad page'
Will not trigger in debug mode!
$ FLASK_APP=echo.py FLASK_DEBUG=0 flask run
curl -I http://localhost:5000/not HTTP/1.0 500 INTERNAL SERVER ERROR
examples/flask/500/app500.py
from flask import Flask app = Flask(__name__) @app.route("/") def main(): return ''' Main <a href="/bad">bad</a> ''' @app.route("/bad") def bad(): raise Exception("This is a bad page") return 'Bad page' @app.errorhandler(500) def not_found(err): #raise Exception("Oups") return "Our Page crashed", 500