O'Reilly logo

Learning Django Web Development by Ratan Kumar, Sanjeev Jaiswal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

IPDB – interactive way of busting bugs

Ipdb is an interactive source code debugger for Python programs.

Run the following command to install Ipdb:

$pip install ipdb

Ipdb is the interactive way of debugging Python application. After installing Ipdb, to use it in any function, just write the following code:

import ipdb;ipdb.set_trace()

This magical line will halt the whole Django execution at the point where this code is present, and will give you an active console, where you can find out the bugs or check the variable's value in real time.

The shortcuts for ipdb (when you are in the active console) are:

  • n: This refers to next
  • ENTER: This refers to repeat previous
  • q: This refers to quit
  • p <variable>: This is the print value
  • c: This refers to continue
  • l

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required