Tutorial by Examples

Most basic Django debugging tool is pdb, a part of Python standard library. Init view script Let's examine a simple views.py script: from django.http import HttpResponse def index(request): foo = 1 bar = 0 bug = foo/bar return HttpResponse("%d goes here." % ...
First, you need to install django-debug-toolbar: pip install django-debug-toolbar settings.py: Next, include it to project's installed apps, but be careful - it's always a good practice to use a different settings.py file for such development-only apps and middlewares as debug toolbar: # If en...
While developing, inserting the following line to your code: assert False, value will cause django to raise an AssertionError with the value supplied as an error message when this line is executed. If this occurs in a view, or in any code called from a view, and DEBUG=True is set, a full and de...
Debugging takes time and effort. Instead of chasing bugs with a debugger, consider spending more time on making your code better by: Write and run Tests. Python and Django have great builtin testing frameworks - that can be used to test your code much faster than manually with a debugger. Writ...

Page 1 of 1