flask deployment using internal werkzeug development server

假如想象 提交于 2019-12-07 17:32:16

问题


Why is it not recommended to use the flask/werkzeug internal development webserver in production? What sort of issues can arise?

I'm asking because in work I'm being forced to do so and use a make shift cron to re-run the service every day!


回答1:


If you're having to use a cron job to kill & restart it on a daily basis, you've already found a major issue with using the Flask development server. The development server is not written for stability, longevity, configurability, security, speed or much of anything other than convenience during development.

A proper WSGI setup will be faster, handle multiple connections properly and, most importantly for you, periodically restart your app process to clean out any cruft that might build up.




回答2:


I had a network call inside the response handler that had no timeout. Something went wrong and it was waiting for a while (I was using the requests module), and then apparently never recovered.

Since Werkzeug server had only one thread, the whole development server became completely unavailable.



来源:https://stackoverflow.com/questions/14592161/flask-deployment-using-internal-werkzeug-development-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!