Flask app “Restarting with stat”

后端 未结 4 921
醉梦人生
醉梦人生 2020-12-01 04:02

I\'ve built a few Flask apps, but on my latest project I noticed something a little strange in development mode. The second line of the usual message in the terminal which

相关标签:
4条回答
  • 2020-12-01 04:32

    If you run with app.run(debug=True), it will run the reloader as part of debug mode. If you don't want to use debug mode, pass debug=False or don't pass it at all.

    0 讨论(0)
  • Use run(use_reloader=False) to disable the reloader.

    It gave me some problems where it wasn't able to find my server file when it restarted. This did the trick. It executed just once and everything worked. Quite odd.

    0 讨论(0)
  • 2020-12-01 04:54

    my filename was __main__.py and I exported it as such: export FLASK_APP=__main__.py Upon changing the name to app.py and reexporting it, it worked.

    0 讨论(0)
  • 2020-12-01 04:57

    Check your version of Werkzeug. Version 0.10 was just released and numerous changes went into the reloader. One change is that a default polling reloader is used; the old pyinotify reloader was apparently inaccurate. If you want more efficient polling, install the watchdog package. You can see the code related to this here.

    When Werkzeug can't find watchdog, it uses the stat reloader, otherwise it uses whatever reloader watchdog uses, which can vary by platform. This message is just so you know which one is in use.


    Watchdog may not be compatible with gevent. If you're using gevent and having issues with the reloader when using Watchdog, check this GitHub issue.

    0 讨论(0)
提交回复
热议问题