0

So after much searching I found a way to get gunicorn to play nice with vscode using the following launch.json

        "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Run Debug",
            "cwd": "${workspaceFolder}/dir/dir2",
            "type": "python",
            "request": "launch",
            "program": "/Users/me/.virtualenvs/dir/bin/gunicorn",
            "args": ["--bind 0.0.0.0:6543", "-w=1", "--paste=local.ini" ],
            "console": "integratedTerminal",
            "justMyCode": false,
            "purpose": ["debug-in-terminal"],
            "gevent": true,
            "env": {
                "GEVENT_SUPPORT": "True",
                "PYTHONUNBUFFERED":"1",
                "OBJC_DISABLE_INITIALIZE_FORK_SAFETY":"YES",
                "PYDEVD_LOAD_NATIVE_LIB": "0",
                "PYDEVD_USE_CYTHON":"0"
            }
     }
    ]
}

Now this makes the server run but it outputs no variables, it doesn't stop at any breakpoints, and I can't watch anything. Basically, the whole left pane is completely empty.

Has anyone dealt with this successfully before?

Demian Licht
  • 129
  • 3
  • 10
  • Can this help? https://stackoverflow.com/questions/39842422/how-does-one-use-the-vscode-debugger-to-debug-a-gunicorn-worker-process – MingJie-MSFT Jun 06 '22 at 02:23
  • @MingJie-MSFT not really, I reckon it's something to do with how vscode handles dependencies rather than pycharm. I made the switch to pycharm and it works so I'm now working on getting vscode to play nice with it. – Demian Licht Jun 07 '22 at 05:10
  • Please provide some more details for me to reproduce. https://stackoverflow.com/help/minimal-reproducible-example I did a simple replay, but only changed the launch.json as yours and simply debugged without any problems. I think I need more information from you to reproduce the issue. – MingJie-MSFT Jun 08 '22 at 06:22
  • Alright so I got it working, it was a matter of explicitly installing my dependencies (i.e pip install -e /User/folder/where/dependency/lies) that made it possible to run it (I guess pycharm does something similar "out of the box" when you add a folder as a dependency, vscode needs you to explicitly do it.) – Demian Licht Jun 08 '22 at 07:13

0 Answers0