Skip to content
Kevin Postal edited this page Apr 6, 2014 · 2 revisions

Tricks and tips for Python and Django development

Contents

  1. Python Debugger
## 1. Python Debugger pdb implements an interactive debugging environment for Python programs. It includes features to let you pause your program, look at the values of variables, and watch program execution step-by-step, so you can understand what your program actually does and find bugs in the logic. ([https://bitbucket.org/dugan/epdb](https://bitbucket.org/dugan/epdb))
  1. Add the import line to set breakpoint in your code.

     import epdb; epdb.serve(4242)
    

import epdb; epdb.serve(4242)

  1. Trigger the code block and launch the Django Shell with manage.py.

     python manage.py shell
    
  2. Enter the following:

     import epdb; epdb.connect(host='127.0.0.1', port=4242)
    
  3. Debug!

debug screenshot

Clone this wiki locally