Search This Blog

Friday, 21 February 2020

VSCode debug configuration for Python Flask /.vscode/launch.json

The first section "Python: Flask API" runs the Flask devServer

The second section "" runs a simple Python app (in this case, the consumer of the service)

{
    // 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 API",
            "type": "python",
            "request": "launch",
            "module": "flask",
            "env": {
                "FLASK_APP": "api/devServer.py",
                "FLASK_ENV": "development",
                "FLASK_DEBUG": "0"
            },
            "args": [
                "run",
                "--no-debugger",
                "--no-reload",
                "--port", "8080",
                "--host", "0.0.0.0"
            ],
            "jinja": true,
            "cwd": "C:\\Work\\api"
        },
        {
            "name": "Python: main.py",
            "type": "python",
            "request": "launch",
            "program": "${workspaceFolder}\\myApp\\main.py",
            "cwd":"${workspaceFolder}\\monitor\\"
        }
    ]
}

No comments:

Post a Comment