Sta*_*nko 8 python django visual-studio-code
我想有可能在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"
]
},
Run Code Online (Sandbox Code Playgroud)
在代码中放置几个断点并运行它.不幸的是,执行不会在带有断点的行上停止.我没有virtualenv尝试相同,一切都很完美.
请指出我在这里做错了什么.
Sud*_*lla 12
你能解决这个问题吗?
对我来说,以下2个更改有效
这是我的配置的相关部分
{
"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"
]
},
Run Code Online (Sandbox Code Playgroud)
1) 按 CTRL + ,
2) 选择工作区设置
3) 在打开的设置文件中添加以下行。
"python.pythonPath": "path_to_your_env"
Run Code Online (Sandbox Code Playgroud)
你完成了!
归档时间: |
|
查看次数: |
5671 次 |
最近记录: |