import traceback
@app.errorhandler(500)
def internal_error(exception):
"""Show traceback in the browser when running a flask app on a production server.
By default, flask does not show any useful information when running on a production server.
By adding this view, we output the Python traceback to the error 500 page.
"""
trace = traceback.format_exc()
return("<pre>" + trace + "</pre>"), 500