你应该用 wsgi 部署 django 吗?
Should you deploy django with wsgi?
需要用wsgi部署django吗?我是 运行 Django 在 Docker 实例上,似乎通常推荐的解决方案只是使用 Django 的开发服务器,即命令 python manage.py runserver
。究竟什么时候需要像 wsgi 这样的 Web 服务器——在这种情况下,在容器化应用程序中,django 开发服务器是否足以用于生产应用程序?
你自己回答问题:
is the django development server enough for production applications ?
在django documentation中,您可以阅读以下内容:
Now’s a good time to note: don’t use this server in anything resembling a production environment. It’s intended only for use while developing. (We’re in the business of making Web frameworks, not Web servers.)
还有this part:
DO NOT USE THIS SERVER IN A PRODUCTION SETTING. It has not gone through security audits or performance tests. (And that’s how it’s gonna stay. We’re in the business of making Web frameworks, not Web servers, so improving this server to be able to handle a production environment is outside the scope of Django.)
所以没有。不要在生产环境中使用 Django 开发服务器。安全风险、性能不佳等
从不推荐将开发服务器作为生产服务器的选项。它有多个 security and performance issues.
对我们来说效果很好的解决方案是 Gunicorn 背后的 Nginx 反向代理(以便多人可以顺利连接。)
this tutorial is a good beginners guide to a Ubuntu setup with nginx and gunicorn. When bringing docker into the mix use this tutorial.中提到的方法
您可以在不使用 WSGI 的情况下使用 Django Channels 在生产中进行部署。
You can set things up in one of two ways; either route all traffic through a HTTP/WebSocket interface server, removing the need to run a WSGI server at all; or, just route WebSockets and long-poll HTTP connections to the interface server, and leave other pages served by a standard WSGI server.
需要用wsgi部署django吗?我是 运行 Django 在 Docker 实例上,似乎通常推荐的解决方案只是使用 Django 的开发服务器,即命令 python manage.py runserver
。究竟什么时候需要像 wsgi 这样的 Web 服务器——在这种情况下,在容器化应用程序中,django 开发服务器是否足以用于生产应用程序?
你自己回答问题:
is the django development server enough for production applications ?
在django documentation中,您可以阅读以下内容:
Now’s a good time to note: don’t use this server in anything resembling a production environment. It’s intended only for use while developing. (We’re in the business of making Web frameworks, not Web servers.)
还有this part:
DO NOT USE THIS SERVER IN A PRODUCTION SETTING. It has not gone through security audits or performance tests. (And that’s how it’s gonna stay. We’re in the business of making Web frameworks, not Web servers, so improving this server to be able to handle a production environment is outside the scope of Django.)
所以没有。不要在生产环境中使用 Django 开发服务器。安全风险、性能不佳等
从不推荐将开发服务器作为生产服务器的选项。它有多个 security and performance issues.
对我们来说效果很好的解决方案是 Gunicorn 背后的 Nginx 反向代理(以便多人可以顺利连接。)
this tutorial is a good beginners guide to a Ubuntu setup with nginx and gunicorn. When bringing docker into the mix use this tutorial.中提到的方法
您可以在不使用 WSGI 的情况下使用 Django Channels 在生产中进行部署。
You can set things up in one of two ways; either route all traffic through a HTTP/WebSocket interface server, removing the need to run a WSGI server at all; or, just route WebSockets and long-poll HTTP connections to the interface server, and leave other pages served by a standard WSGI server.