我想有可能在Visual Studio Code中调试Django应用程序。我有一个virtualenv,对launch.json文件进行了更改,如下所示:
{
"name": "Django",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"pythonPath": "${workspaceRoot}/.venv/bin/python2.7",
"program": "${workspaceRoot}/mysite/manage.py",
"args": [
"runserver"
],
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"DjangoDebugging",
"RedirectOutput"
]
},
在代码中放置几个断点并运行它。不幸的是,执行并没有在带有断点的行上停止。我在没有virtualenv的情况下尝试了同样的方法,并且一切正常。
请指出在这里我做错了什么。
对我来说,以下2项更改有效
"--noreload"
在启动项目时使用该选项这是我的配置的相关部分
{
"name": "Django",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"pythonPath": "/Users/xyz/Documents/dev/my_project/my_project_env/bin/python",
"program": "${workspaceRoot}/manage.py",
"args": [
"runserver",
"0.0.0.0:8080",
"--noreload"
],
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput",
"DjangoDebugging"
]
},
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句