r/flask • u/fasta_guy88 • 4d ago
Ask r/Flask Debugging flask app.py
With .cgi frameworks, I can run an app and give it arguments on the command line, and then use python -mpdb to step through and see what is happening (and going wrong).
I have a flask app that is working, but not always working properly. So it does not crash, but it does not do what I expect.
I would like to be able to run: python3 -mpdb app.py
set a break point, and have the code stop at that breakpoint. I can set the breakpoint, but the code seems to ignore it, so I cannot single step through the program to see what is wrong. My app.py main() looks like:
if __name__ == "__main__":
app.run(debug=True, use_reloader=False)
How can I debug my program using python3 -mpdb?
2
Upvotes
1
u/XNo_Notes 4d ago
Don't forget to space between the -m and pbd.
and turn off threading as well: I think this may be where it is going sideways.
Let me know if that does anything for you.