Production debugging a python app under uwsgi, supervisord, and nginx

47 Views Asked by At

I know production debugging should be avoided, but I think maybe sometimes it's unavoidable...

I need to be able to attach a debugger to a python app on production. I've tested on dev and staging that the app works as it should, but it still breaks on prod.

The app is running using uwsgi, under the supervisord process manager, behind nginx.

My current understanding is I should use the debugpy package and run my app under the debugpy context, for example:

python -m debugpy --wait-for-client --listen 0.0.0.0:5678 manage.py runserver

But I don't think spawning all processes under debugpy is a good idea (performance hit, security issues, and the fact that the process won't run if no client is connected to the debugger).

How should I do this securely while avoiding downtime?

0

There are 0 best solutions below