【发布时间】:2022-01-02 04:35:58
【问题描述】:
我目前有一个烧瓶应用程序,其中文件结构如下所示:
C:\Users\kmelton\Python\Flask\BGSCS-API-dev\InterjectApi\server.py
我目前在 VS Code 中作为工作区打开的文件夹是 BGSCS-API-dev 文件夹。
我的 launch.json 目前看起来像这样:
{
// 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: Flask",
"type": "python",
"request": "launch",
"module": "flask",
"env": {
"FLASK_APP": "server.py",
"FLASK_ENV": "development"
},
"args": [
"run",
"--no-debugger"
],
"jinja": true
}
]
}
在每次调试尝试时,我都会收到一个错误。
* Serving Flask app 'server.py' (lazy loading)
* Environment: development
* Debug mode: on
Usage: python -m flask run [OPTIONS]
Try 'python -m flask run --help' for help.
Error: Could not import 'server'.
我知道我可能需要将一些内容添加到我的 launch.json 文件中以正确地指向文件的路径,但是我尝试过的东西对我不起作用。谢谢
【问题讨论】:
标签: python debugging flask visual-studio-code vscode-debugger