While working with AppEngine locally (i.e. using dev_appserver.py), is there anyway to do a step-by-step debugging? It is a too old fashion to use logging.info() or similar functions to show the values of all the variables in the code and decide where the error is.
To expand a little bit on codeape's answer's first suggestion: Because dev_appserver.py mucks about with stdin, stdout, and stderr, a little more work is needed to set a "code breakpoint". This does the trick for me:
import sys
for attr in ('stdin', 'stdout', 'stderr'):
setattr(sys, attr, getattr(sys, '__%s__' % attr))
import pdb
pdb.set_trace()
You'll have to run dev_appserver.py
from the command line rather than via the GUI App Engine Launcher. When the pdb.set_trace()
line is executed, you will be dropped into the pdb
debugger at that point.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With