访问sqalchemy db.model时VSCode Flask调试器不起作用

时间:2018-08-15 18:23:30

标签: python flask sqlalchemy visual-studio-code

我正在尝试2种配置:

在“ Python:烧瓶”配置上:

查询sqlalchemy时会引发异常:

One or more mappers failed to initialize - can't proceed with initialization of other mappers. Triggering mapper: 'Mapper|User|users'. Original exception was: When initializing mapper Mapper|User|users, expression 'UserGroupAssociation' failed to locate a name ("name 'UserGroupAssociation' is not defined"). If this is a class name, consider adding this relationship() to the <class 'project.models.user.User'> class after both dependent classes have been defined

我可以在此配置“ Python:Flask” 上的基本ping服务上命中调试器断点

但是如果运行“ Flask(0.10.x或更早版本)” 配置,如果我运行,我的所有端点都不会产生任何异常,但是没有断点被击中

这是我的launch.json:

{
"version": "0.2.0",
"configurations": [
    {
        "name": "Flask (0.10.x or earlier)",
        "type": "python",
        "request": "launch",
        "envFile": "${workspaceFolder}/.env",

        "program": "${workspaceFolder}/manage.py",
        "args": [
            "run",
            "-h",
            "0.0.0.0",
            "-p",
            "8000",
            "--no-reload"
        ]
    },
    {
        "name": "Python: Flask",
        "type": "python",
        "request": "launch",
        "module": "flask",
        "pythonPath": "${config:python.pythonPath}",
        "cwd": "${workspaceFolder}",
        "envFile": "${workspaceFolder}/.env",
        "args": [
            "run",
            "-h",
            "0.0.0.0",
            "-p",
            "8000",
            "--no-debugger",
            "--no-reload"
        ],
        "debugOptions": [
            "RedirectOutput",
            "DebugStdLib"
        ],
        "stopOnEntry": false
    }
]

}

谢谢

0 个答案:

没有答案