问题描述
我已经构建了一些Flask应用程序,但是在我的最新项目中,我发现在开发模式中有点奇怪。终端中常见消息的第二行总是读取: *运行于http://127.0.0.1:5000 /
*使用重新加载程序
重新启动:
*用stat
重新启动
我不认为自己做了什么不同的事情,实际上我是从克隆一个我已经用过很多次的starter-kit项目开始的,而这个项目本身并没有显示出这种行为。我也注意到这个项目稳定地消耗了大约15%的CPU,而我的其他项目几乎没有任何瑕疵。
任何想法为什么发生这种情况? $ b
检查您的Werkzeug版本。版本0.10刚刚发布,许多更改进入reloader。一个变化是使用默认的轮询重载器;旧pyinotify reloader显然是不准确的。如果您想更高效地进行轮询,请安装软件包。您可以在这里看到与此。
当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.
这篇关于Flask应用程序“使用stat重新启动”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!