pythondebuggingvisual-studio-codegunicorn

How does one use the VSCode debugger to debug a Gunicorn worker process?


I have a GUnicorn/Falcon web service written in Python 3.4 on Ubuntu 14.04. I'd like to use the VSCode debugger to debug this service. I currently start the process with the command

/usr/local/bin/gunicorn --config /webapps/connects/routerservice_config.py routerservice:api

which starts routerservice.py using the config file routerservice_config.py. I have workers set to 1 in the config to keep it simple.

I've installed the Python extension to VSCode so I have the Python debugging tools. So how do I attach to the GUnicorn worker process or have VSCode run the startup command and auto attach.

Thanks, Greg


Solution

  • I'm the author of the extension. You could try the following: https://github.com/DonJayamanne/pythonVSCode/wiki/Debugging:-Remote-Debuging

    FYI:
    - This requires you to include the ptvsd package and configure it in your application.
    - The plan is to add the feature to attach the debugger to any python process in the future (hopefully near future).