最近在运行程序的时候,突然发现程序启动不起来了,系统停在restrating with stat 处就不动了。查了下配置,感觉有可能是flask werkzeug出问题了。
好着的时候,状态应该是这样的:
Running on http://127.0.0.1:5000/
* Restarting with reloader
现在变成了如下:
* Restarting with stat
抄录解决方案如下:
## 方案一:
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.
## 方案二: 【测试这个方案对我无效,可能和我用socketio有关系】
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.
## 方案三:
我发现我在配置文件中将开发环境中的debug设为了True,而正式环境中并没有,导致其停滞。所以临时解决方案是将正式环境中的debug也设置成了True,就能正常运行了。