Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I use pdb with gunicorn to inspect what is happening in my webapp? #186

Closed
mw44118 opened this issue Mar 25, 2011 · 3 comments
Closed

Comments

@mw44118
Copy link

mw44118 commented Mar 25, 2011

Apparently, with cherrypy, you can add pdb.settrace() in the middle of your app code, and then in the terminal where you started cherrypy, after you hit that code in your browser, you can then walk around and inspect stuff.

I just heard about this; I haven't seen it first-hand. But I know that similar stuff exists in .NET and other frameworks.

Could something like this be set up in gunicorn? How?

@davisp
Copy link
Collaborator

davisp commented Mar 28, 2011

Easiest method would be to do your pdb configuration in the post_fork hook while using a single sync worker.

If you find something that doesn't actually work, feel free to reopen this.

@davisp davisp closed this as completed Mar 28, 2011
@sdiehl
Copy link

sdiehl commented Aug 29, 2011

I stumbled upon this issue and thought I would share the config file I use to do this:

gunicorn_logfile = "/dev/null"
gunicorn_loglevel = "error"

debug = True
timeout = 900000
workers = 1
worker_class = "sync"

Throwing down a pdb.set_trace() then works with either pdbpp or pdb without the debugger getting mixed up with stdout.

@mw44118
Copy link
Author

mw44118 commented Mar 23, 2012

That timeout thing was just what I was looking for. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants