vs代码远程容器未在断点处停止

时间:2019-06-19 05:37:30

标签: python django visual-studio-code remote-debugging

我有一个带有devcontainer.json和launch.json的设置,并且在vs-code中有新的Remote Container插件。但是我无法使断点正常工作。我启动了应用程序并可以浏览它,但是断点没有命中,我的launch.json中缺少什么吗?

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Django",
            "type": "python",
            "request": "launch",
            "program": "${workspaceFolder}/manage.py",
            "args": [
                "runserver",
                "0.0.0.0:8000",
            ],
            "env": {
                "PYTHONUNBUFFERED": 1,
                "ENV": "local",
                "DJANGO_SITE_ID": 1,
                "DJANGO_SETTINGS_MODULE": "project.settings.local1",
            }
        }
    ]
}

1 个答案:

答案 0 :(得分:1)

您的配置与Django的默认launch.json配置不同,并且缺少了一些关键部分(看起来丢失的所有内容都很重要):

    {
        "name": "Python: Django",
        "type": "python",
        "request": "launch",
        "program": "${workspaceFolder}/manage.py",
        "console": "integratedTerminal",
        "args": [
            "runserver",
            "--noreload",
            "--nothreading"
        ],
        "django": true
},