Debug Python

By pjain      Published April 21, 2020, 7:38 p.m. in blog Programming   

Debug 101

Debug 101

How to debug Django

  • see error console line numbers
  • TIP: Keep checklist/list of common errors - often it is same ones that keep coming up!

PDB Print out into console

  • PDB (Python Debugger). That comes in a standart set of usual python distribution
  • key docs
  • command list

  • In code that you may need to debug import pdb

  • And then somewhere in code in a place where you need to stop and watch. pdb.set_trace()
  • Execute server in some accessible console (eg in a ssh terminal) ..
  • CLI when it hits path of code .. will provide REPL >>> param ['exapmple', 'values', 'list'] >>> help >>> print param # ['exapmple', 'values', 'list'] >>> dir(param) # Lists more detail about variables, etc..

Browser Debugging - chrome dev tools

Debug, 10x



There are no comments yet

Add new comment

Similar posts

Sublime Text, Plugins and Custom Programming in Python

Database Programming in Python

Python Applications and Frameworks 101

Python Scratch, Notes