点击debug选项的设置按钮,vscode会让我们编辑launch.json文件
{"version": "0.2.0","configurations": [{"name": "Python 调试程序: 当前文件","type": "debugpy","request": "launch","program": "${file}","console": "integratedTerminal"},{"name": "Poetry: Current File","type": "python","request": "launch","module": "poetry","cwd": "${workspaceFolder}","console": "integratedTerminal","args": ["run","python","${file}"],"env": {"ENV_FOR_DEMO": "dev","PYDEVD_DISABLE_FILE_VALIDATION": "1"}}]
}
调试时使用第二个 【Poetry: Current File】即可进入断点配合vscode的调试。