电子商务网站建设项目的阶段,免费发群二维码的网站,佛山公司建站,二手车 网站开发目的
注意#xff1a;这里我们想要实现的是#xff1a;用vscode 使用remote ssh打开project#xff0c;然后直接在project里面进行debug#xff0c;而不需要 在本地vscode目录打开一样的project。
假设大家已经会使用remote ssh打开远程服务器的代码了#xff0c;那么只…目的
注意这里我们想要实现的是用vscode 使用remote ssh打开project然后直接在project里面进行debug而不需要 在本地vscode目录打开一样的project。
假设大家已经会使用remote ssh打开远程服务器的代码了那么只需要简单的3步即可。
第一步安装debugpy
pip install debugpy第二步配置launch.json
怎么创建lauch.json?? 打开想要调试的文件比如test.py然后直接点击running debug那么会自动配置一个默认的json点击这里即可出现。 然后增加一个remote的配置只要点击 add configuration如下图。 然后选择remote attach。 之后随便设置一个port并且host设置为0.0.0.0
{// Use IntelliSense to learn about possible attributes.// Hover to view descriptions of existing attributes.// For more information, visit: https://go.microsoft.com/fwlink/?linkid830387version: 0.2.0,configurations: [{name: Python: Remote Attach,type: python,request: attach,connect: {host: 0.0.0.0,port: 10010},pathMappings: [{localRoot: ${workspaceFolder},remoteRoot: .}],justMyCode: false}]
}第三步执行debugpy
这里ip和port就是刚才配置的在远程服务器上执行
python3 -m debugpy --listen 0.0.0.0:10010 --wait-for-client test.py开始debug
在远程服务器的test.py文件里打上断点直接运行running debug即可。