Skip to content

Instantly share code, notes, and snippets.

@alonho
Created December 27, 2012 15:40
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save alonho/4389137 to your computer and use it in GitHub Desktop.
Save alonho/4389137 to your computer and use it in GitHub Desktop.
Flask: drop into pdb on exception
def drop_into_pdb(app, exception):
import sys
import pdb
import traceback
traceback.print_exc()
pdb.post_mortem(sys.exc_info()[2])
# somewhere in your code (probably if DEBUG is True)
flask.got_request_exception.connect(drop_into_pdb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment