Skip to main content

Add '--pdb' option to ' runserver' and ' test'

Project description

Make debugging Django easier

Adding pdb.set_trace() to your source files every time you want to break into pdb sucks.

Don’t do that.

Do this.


Install using pip:

pip install django-pdb

Add to your django project:


Usage runserver --pdb

Drops into pdb at the start of every view:

bash: testproject/ runserver --pdb
Validating models...

0 errors found
Django version 1.3, using settings 'testproject.settings'
Development server is running at
Quit the server with CONTROL-C.

function "myview" in testapp/
args: ()
kwargs: {}

> /Users/tom/github/django-pdb/testproject/testapp/
-> a = 1
(Pdb) test --pdb

Drops into pdb on test errors/failures:

bash: testproject/ test testapp --pdb
Creating test database for alias 'default'...
>>> test_error (testapp.tests.SimpleTest)
Traceback (most recent call last):
  File "/Users/tom/github/django-pdb/testproject/testapp/", line 16, in test_error
    one_plus_one = four
NameError: global name 'four' is not defined

> /Users/tom/github/django-pdb/testproject/testapp/
-> one_plus_one = four

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-pdb, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size django-pdb-0.1.tar.gz (3.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page