How to debug a Flask app

前端 未结 13 2345
陌清茗
陌清茗 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 03:57

    Install python-dotenv in your virtual environment.

    Create a .flaskenv in your project root. By project root, I mean the folder which has your app.py file

    Inside this file write the following:

    FLASK_APP=myapp 
    FLASK_ENV=development
    

    Now issue the following command:

    flask run
    

提交回复
热议问题