在 VS Code 中设置 UWSGI 调试

Ale*_*u R 8 uwsgi python-3.x visual-studio-code vscode-debugger

我正在尝试使用 VS 代码调试本地 uwsgi。不幸的是,我无法将 python 解释器附加到我的可视化代码调试中:

VSCode launch.json 配置:

{
        "type": "python",
        "request": "attach",
        "name": "Launch uWSGI",
        "port": 9090,
        "host": "127.0.0.1",
        "pathMappings": [
            {
                "localRoot": "${workspaceFolder}",  // You may also manually specify the directory containing your source code.
                "remoteRoot": "${workspaceFolder}" // Linux example; adjust as necessary for your OS and situation.
            }
        ]
    }
Run Code Online (Sandbox Code Playgroud)

和uwsgi配置:

[development]
virtualenv = %(chdir)/../env/env1/
http = 127.0.0.1:9090
Run Code Online (Sandbox Code Playgroud)

然后我在本地启用的 venv 中运行 uwsgi:

uwsgi --ini conf.d/uwsgi/dev.ini
Run Code Online (Sandbox Code Playgroud)

输出如下:

detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI http bound on 0.0.0.0:3001 fd 4
uWSGI http bound on 127.0.0.1:9090 fd 5
uwsgi socket 0 bound to TCP address 127.0.0.1:42183 (port auto-assigned) fd 3
Python version: 3.7.2 (default, Jan 11 2019, 21:31:15)  [GCC 5.4.0 20160609]
Run Code Online (Sandbox Code Playgroud)