Skip to content

Instantly share code, notes, and snippets.

@probonopd
Last active February 10, 2018 17:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save probonopd/8616a8ff05c8a75e4601 to your computer and use it in GitHub Desktop.
Save probonopd/8616a8ff05c8a75e4601 to your computer and use it in GitHub Desktop.
Show flask traceback when running on production server
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
@nguyenbathanh
Copy link

Doesn't work.

@valleedelisle
Copy link

Confirmed, doesn't work here either

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment