【问题标题】:What is workable VS Code configuration to debug Django custom commands?调试 Django 自定义命令的可行 VS Code 配置是什么?
【发布时间】:2019-08-27 17:32:55
【问题描述】:

我正在使用 Visual Studio Code IDE 开发、调试我的 Django 项目。我几乎没有管理自定义命令,不知道如何从 VS Code 调试该代码。 我尝试了不同的配置,但没有一个有效。

我试过的配置是

        {
            "name": "Python: Module",
            "type": "python",
            "request": "launch",
            "program": "${workspaceFolder}/manage.py",
            "args": [
                "send_daily",              
            ],
            "console": "integratedTerminal"
        },

此配置不会在我设置的断点处停止。

我希望调试器在自定义命令代码中设置的断点处启动并停止执行。

【问题讨论】:

    标签: django debugging configuration visual-studio-code command


    【解决方案1】:

    我认为您可能需要将 'django': true 作为字段添加到配置中,例如此示例以调试迁移管理命令:

                "name": "Debug Django Migration",
                "type": "python",
                "request": "launch",
                "program": "${workspaceFolder}/manage.py",
                "console": "integratedTerminal",
                "args": [
                    "migrate",
                ],
                "django": true
            },
    

    关于 django 字段https://code.visualstudio.com/docs/python/debugging#_django的信息

    【讨论】:

      猜你喜欢
      • 2019-09-24
      • 1970-01-01
      • 2018-07-21
      • 1970-01-01
      • 2014-05-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多