【问题标题】:Vs code remote container not stopping on breakpointsVs 代码远程容器不在断点处停止
【发布时间】:2019-11-01 18:43:30
【问题描述】:

我有一个 devcontainer.json 和一个带有新远程容器插件在 vs-code 中的 launch.json 的设置。但我无法让断点工作。我启动了应用程序并可以浏览它,但没有命中断点,我的 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",
            }
        }
    ]
}

【问题讨论】:

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


    【解决方案1】:

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

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

    【讨论】:

    • 这确实是正确的,它现在可以工作了。为什么必须 --noreload 才能让它工作?是否可以采取任何其他步骤来自动重新加载?
    • 我们正在努力让它工作(由于 Django 创建新进程并因此检测到然后附加调试器,这很复杂)。您可以跟踪this issue,了解我们希望它何时准​​备就绪。
    • 感谢 Brett 的帮助和所有出色的工作!
    猜你喜欢
    • 2021-04-20
    • 1970-01-01
    • 2012-08-24
    • 2021-07-01
    • 2013-09-26
    • 2020-08-20
    • 2020-08-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多