From f65abc2cd4cff4ddf42222fa3e1fea9254cc4722 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 22 May 2023 08:46:05 +0300 Subject: Add documentation on running flask under pdb --- topics/using-pdb-to-troubleshoot.gmi | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/topics/using-pdb-to-troubleshoot.gmi b/topics/using-pdb-to-troubleshoot.gmi index 06ac37a..4cfe616 100644 --- a/topics/using-pdb-to-troubleshoot.gmi +++ b/topics/using-pdb-to-troubleshoot.gmi @@ -1,6 +1,6 @@ # Using PDB to Troubleshoot Python Code -# Tags +## Tags * type: documentation * keywords: debugging, python @@ -97,8 +97,27 @@ With regards to testing, pdb is also integrated with test-runners. To use pdb wi | pytest --pdb `---- +## Running Flask Applications Under pdb -### Useful Tutorials +To troubleshoot a Flask application (and any other application running via an +applicationsserver of sorts), you might need to start the application server under +the debugger, otherwise, you will get an error like: + +``` +BdbQuit +``` + +Ideally, you shouldn't need to, as the terminal where you started the +application server (Flask) should drop you into the debugger automatically. + +If you run the application under other application servers like gunicorn, then +you might need to increase the timeout period to prevent gunicorn from killing +the process, leading to the error above. Generally speaking, you **SHOULD NOT** +be running the debugger in production anyway, and therefore you should not need +to deal with the gunicorn issues. + + +## Useful Tutorials To learn more about pdb, you can check out: -- cgit v1.2.3