How to debug a Flask app

前端 未结 13 2487
陌清茗
陌清茗 2020-11-22 03:08

How are you meant to debug errors in Flask? Print to the console? Flash messages to the page? Or is there a more powerful option available to figure out what\'s happening

13条回答
  •  孤城傲影
    2020-11-22 04:02

    From the 1.1.x documentation, you can enable debug mode by exporting an environment variable to your shell prompt:

    export FLASK_APP=/daemon/api/views.py  # path to app
    export FLASK_DEBUG=1
    python -m flask run --host=0.0.0.0
    

提交回复
热议问题