【发布时间】:2019-02-18 08:29:30
【问题描述】:
网络上有绝大多数教程和文档都在开发状态下运行 Flask。开发模式下的日志如下所示:
* Serving Flask app "app" (lazy loading)
* Environment: production
WARNING: Do not use the development server in a production environment.
Use a production WSGI server instead.
* Debug mode: on
* Running on http://0.0.0.0:5555/ (Press CTRL+C to quit)
我想了解更多有关如何使其生产就绪的信息。我也看到过使用生产就绪的 WSGI 服务器和 nginx 作为前面的反向代理的文档。但是有人能告诉我为什么需要 WSGI 和反向代理吗?
如果我的 Flask 应用程序是 dockerized 并在 Google Kubernetes Engine 中运行,那是否还有必要呢? GKE 会不会照顾 WSGI 和反向代理的目的?
【问题讨论】:
-
我之前也考虑过这个问题。在裸机 VM 上部署
Flask应用程序时,似乎需要大多数工具(gunicorn、uWSGI)等。有了 Kubernetes 及其所有的负载平衡和各种服务器端的处理,这些有必要吗?
标签: flask web-applications kubernetes reverse-proxy wsgi