Debug a Flask (Python) web application in Visual Studio Code

后端 未结 8 1882
失恋的感觉
失恋的感觉 2020-12-11 04:28

How do I configure Visual Studio Code to debug a Flask (Python) web application?

For example, when I set the debugger in the view function, it should allow me to step

8条回答
  •  醉梦人生
    2020-12-11 05:15

    I don't use Visual Studio Code for Python development. However, Flask has a really nice debugging option, that allows you to debug from a browser. This is not a solution for Visual Studio Code, but a workaround.

    When you define your application, pass the debug = true parameter to enable debugging mode. Then you can debug your code from the browser.

    app = Flask(__name__)
    app.config['DEBUG'] = True
    

    More information can be found here.

提交回复
热议问题