且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Flask应用程序“使用stat重新启动”

更新时间:2023-10-16 11:02:04

检查您的Werkzeug版本。版本0.10刚刚发布,许多更改进入reloader。一个变化是使用默认的轮询重载器;旧pyinotify reloader显然是不准确的。如果您想更高效地进行轮询,请安装 watchdog 软件包。您可以在这里看到与此相关的代码



当Werkzeug无法找到看门狗时,它使用 stat reloader,否则它使用看门狗使用的任何reloader,平台。这个消息只是让你知道哪一个正在使用。


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 always reads:

 * Running on http://127.0.0.1:5000/
 * Restarting with reloader

has been replaced by:

 * Restarting with stat

I don't think I've done anything different, in fact, I started by cloning a starter-kit project that I have used many times, which itself, does not display this behavior. I also notice that this project consumes about 15% CPU steadily, whereas my other project are barely a blip.

Any ideas why this is happening?

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.