March 2020
Intermediate to advanced
608 pages
17h 17m
English
Before creating a monkey patch, we need to completely understand how the code that we want to modify works. This can be done by analyzing the existing code and inspecting the values of different variables. To do this, there is a useful built-in Python debugger module, pdb, that can be temporarily added to the Django code (or any third-party module) to stop the execution of a development server at any breakpoint. Use the following code to debug an unclear part of a Python module:
breakpoint()
This launches the interactive shell, where you can type in the variables in order to see their values. If you type c or continue, the code execution will continue until the next breakpoint. If you type q or quit, the management command ...
Read now
Unlock full access