Friday, November 10, 2017

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.

No comments:

Post a Comment

Integrating Firefox and Selenium Webdriver

I am posting this on my blog to remind me what to do if I have to integrate firefox, and selenium webdriver. firstly, install selenium usi...