django调试配置
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Django",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/django_project/manage.py",
"args": [
"runserver",
// ip:port
"0.0.0.0:8000"
],
"django": true,
// 是否允许调试过程中进入源码中
"justMyCode": false
}
]
}
flask调试配置
flask的配置相对django的复杂一点
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
// 指定调试器名称,在调试窗口可以选择的
"name": "Python: demo",
"type": "python",
"request": "launch",
// 以模块的方式启动
"module": "flask",
// 设置对应的工作目录,项目工作目录
"cwd":"${workspaceFolder}/ProjectDir",
// 以脚本程序的方式启动
// "program": "${worksapceRoot}/ProjectDir/app/main.py",
"env": {
// 指定启动文件
// 指定app的启动主程序,如果配置了program则不要设置这个选项
"FLASK_APP": "app/main.py",
// flask 环境变量启动的一个常规设置
"FLASK_ENV": "development",
// 私密配置文件指定,以FLASK_APP所在目录为工作目录
// 这个目录选错了,会导致读取不到配置的变量
"ENV_CONFIG": "settings/secret_conf.py",
// 启动debug模式
"FLASK_DEBUG": "1",
},
// 启动参数
// 启动参数对照
// flask run -h remoteHostIP -p Port [other options]
"args": [
"run",
"-h",
"192.168.1.10",
"-p",
"8000",
// 是否启动调试和重载
// 更多配置参数,通过flask run --help 查询到
// "--reload",
// "--debugger"
],
"jinja": true,
// 是否允许调试过程中,进入到源码中
// 如果不设置这个,在源码中的断点显示为白色点(而不是红色)
// 代码不会调转到源码中
// 开启此选项后,当重启flask后,vscode会显示代码异常报错
// 实际代码并没有报错,目前没有找到合适的解决方案
// "justMyCode": false
},
]
}