Working on a python / django project

I am blogging about what I learned while working in a python/django project.

Using `pdb` is best to debug in real-time your python/django project.
To run pdb on a python file,

python -m pdb <python file>
To run pdb on django project,
python -m pdb runserver
this will initialize pdb on your django project.
Place this one line of python code to put pdb to work in that line of your code:
when you start interacting with your django project, either GET/POST requests,
pdb will start to work when the execution reaches the part of your code where you put
the pdb.set_trace(). you can execute one line of python code to check for values of the variables.

If you want to execute multiple lines of python code while in pdb mode, type this code:
import code

This will make you go to interactive python debugger.
and then when you think you are done and you want to go back to pdb mode,

Ctrl + D
and you will be back to pdb mode.


Popular posts from this blog

Setting up a Wordpress Site NGINX and MySQL

Making Movie Reviews