- 
      
 - 
        
Save tony/cde2715fd0553aa1dde2f8aefe31339b to your computer and use it in GitHub Desktop.  
    Flask: drop into pdb on exception
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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