我是这样改的:
manager.add_command('runserver', Server(use_debugger=True,host='0.0.0.0',port='5000'))
再在 launch.json 里面改成
{
"name": "Python: Flask (0.11.x or later)",
"type": "python",
"request": "launch",
"stopOnEntry": false,
"program": "${file}",
"pythonPath": "${workspaceFolder}/venv/Scripts/python",
//"pythonPath": "${config:python.pythonPath}",
//"module": "flask",
"cwd": "${workspaceFolder}",
"env": {
//"FLASK_APP": "${workspaceFolder}/
manage.py"
},
"args": ["runserver"],
"envFile": "${workspaceFolder}/.env",
"debugOptions":[
"RedirectOutput"
]
}
即当作单个文件来运行。
回到
manage.py 页面,F5 运行。这样是有效的。