[英]How to debug python flask application into VS Code 2017
I am working on the flask project. 我正在研究烧瓶项目。 I am executing my project using 我正在使用我的项目
py app.py -v
The app.py
is the main file that runs the program. app.py
是运行程序的主文件。 I have a backend.py
where I call routes and methods. 我有一个backend.py
,我在其中调用路由和方法。 This is vs code settings 这是vs代码设置
{
// 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": "app.py"
},
"args": [
"run",
"--no-debugger",
"--no-reload",
"-v"
],
"jinja": true
}
]
}
I am also getting error due to passing -v
as argument. 我也因为传递-v
作为参数而得到错误。 Is that any specific way to pass the argument? 这是通过论证的任何具体方式吗?
I want to debug backend.py
method or route when user submit or perform any operation but my main application start by app.py
. 我想在用户提交或执行任何操作时调试backend.py
方法或路由,但我的主应用程序由app.py
启动。 Please guide me, how I could do with vs code 2017. 请指导我,我如何处理vs代码2017。
You're passing -v
to flask run
, not to your own script. 你传递-v
到flask run
,而不是你自己的脚本。 I suspect Flask has a way to flag when arguments to flask run
stops and arguments to your own code starts (typically --
in other programs). 我怀疑Flask有办法标记当flask run
参数停止并且你自己的代码的参数开始时(通常是--
在其他程序中)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.