PROJECTS NOTES HOME

Debugging Python and Django app with pdb

Import pdb to your python file:

import pdb;

Set a breakpoint in your code like such:

pdb.set_trace()

Execute the code, or in django case, runserver and visit the page where the breakpoint is supposed to be triggered, it can also be a django-admin page

See all the commands available here - https://djangostars.com/blog/debugging-python-applications-with-pdb/