尝试在VSCode中调试Werkzeug Django应用程序时出现“No module named manage”错误

af7jpaap  于 2022-11-26  发布在  Go
关注(0)|答案(2)|浏览(165)

bounty将在5天后过期。回答此问题可获得+50的声望奖励。Á. Márton希望吸引更多人关注此问题:它不工作请帮助

正如标题所说,我有一个Django 4.1应用程序,它使用Werkzeug来启用https。我设置了以下launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Django",
            "type": "python",
            "request": "launch",
            "python": "${workspaceFolder}/venv/Scripts/python.exe",
            "program": "${workspaceFolder}\\appname\\manage.py",
            "args": [
                "runserver_plus",
                "--cert-file",
                "${workspaceFolder}/certs/cert.pem",
                "--key-file",
                "${workspaceFolder}/certs/key.pem"
            ],
            "justMyCode": false,
            "django": true
        }
    ]
}

当我通过VSCode调试器运行这个程序时,它会立即在get_wsgi_application()函数中退出,并显示“没有名为manage的模块”。我试着在谷歌上搜索,但没有找到有用的答案。你知道我做错了什么吗?

kfgdxczn

kfgdxczn1#

试试这个

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Django",
            "type": "python",
            "request": "launch",
            "python": "${workspaceFolder}/venv/Scripts/python.exe",
            "program": "${workspaceFolder}/manage.py",
            "args": [
                "runserver",
            ],
            "justMyCode": false,
            "django": true
        }
    ]
}
sdnqo3pr

sdnqo3pr2#

manage.py 位于项目的基目录中。

"program": "${workspaceFolder}\\manage.py",

相关问题