
{ "name": "Python: Flask (0.11.x or later)", "type": "python", "request": "launch", "module": "flask", "env": { "FLASK_APP": "manage.py" }, "args": [ "run" ] }, * Serving Flask app "manage.py" * Environment: production WARNING: Do not use the development server in a production environment. Use a production WSGI server instead. * Debug mode: off * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) -----------------------分割线---------------------------------
1 ludwigwangwang 2020 年 3 月 26 日 我是这样改的: 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 运行。这样是有效的。 |