Get the latest tech news
Django: Fix a view using a debugger with breakpoint()
Python’s breakpoint() function opens its debugger, pdb, which pauses the program and allows you to inspect and modify things. Let’s look at an example of using it within a Django view, from a sample project included in Boost Your Django DX.
Python’s breakpoint() function opens its debugger, pdb, which pauses the program and allows you to inspect and modify things. Underneath the table are two filter buttons, “Hungry” and “Satiated”, which allow you to select only animals with those hunger levels. Compared to print() debugging, pdb allowed us to inspect the expressions we wanted without modifying the code, restarting the server, and reloading the page for each check.
Or read this on Hacker News