2

I'm running a flask rest api using vscode as the IDE. I could setup the VSCode launcher in order to debug the application.

launch.json

  {
        "name": "Python: Flask",
        "type": "python",
        "request": "launch",
        "module": "flask",
        "env": {
            "FLASK_APP": "wsgi.py",
            "FLASK_ENV": "development",
            "FLASK_DEBUG": "1"
        },
        "args": [
            "run",
            "--host",
            "0.0.0.0",
            "--port",
            "5000",
        ],
        "jinja": false,
        "justMyCode": true
    },

I need to use web sockets, so I've installed flask_socketio and eventlet extensions. To make the app working again I've replaced

if __name__ == '__main__':
    app.run(host="0.0.0.0", port=5000) 

by

if __name__ == '__main__':
    socketio.run(app, host="0.0.0.0", port=5000, debug=True, use_reloader=True, log_output=True)

After that, the VS Debugger stopped working.

Do any of you know if it is possible to configure VSCode to continue debugging this app?

Thanks in advance

1 Answers1

1

To use the VSCode debugger with eventlet or gevent you have to enable the gevent option, as indicated in the documentation.

The option is named after gevent, but should have been named "greenlet" really, as I have found that it also applies to eventlet.

Miguel Grinberg
  • 65,299
  • 14
  • 133
  • 152