Django Debugging Consider Writing More Documentation, Tests, Logging and Assertions Instead of Using a Debugger


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.
  • Writing proper documentation for your functions, classes and modules. PEP 257 and Google's Python Style Guide supplies good practices for writing good docstrings.
  • Use Logging to produce output from your program - during development and after deploying.
  • Add assertions to your code in important places: Reduce ambiguity, catch problems as they are created.

Bonus: Write doctests for combining documentation and testing!