在heroku 上为我的django 应用程序安装gunicorn 有什么好处?
我最近为正在开发的 Web 应用程序切换到 Django,并按照 Heroku 中的说明进行操作用于让 Django 应用程序在 Heroku 上运行。我有一个虚拟环境,在其中开发我的应用程序,我使用 git 进行版本控制并推送到 Heroku。上面的链接建议我安装gunicorn:
上面的示例使用了 Django 的默认 HTTP 服务器。为了 生产应用程序,您可能希望使用更适合生产的嵌入式 Web 服务器,例如 Tornado、gevent 的 WSGI 服务器或 Gunicorn。
然后他们引导用户安装 Gunicorn。
我的问题是:如果我跳过这一步并保留默认值,可能会遇到什么问题? Gunicorn 会给我带来什么好处?
I have recently switched to Django for a web app I'm developing and I followed the instructions at Heroku for getting a Django app running on Heroku. I have a virtual environment in which my app is developed and I use git for version control and to push to Heroku. The link above suggests that I intall gunicorn:
The examples above used the default HTTP server for Django. For
production apps, you may wish to use a more production-ready embedded
webserver, such as Tornado, gevent’s WSGI server, or Gunicorn.
They then walk the user through installing Gunicorn.
My question is: what problems might I run into if I skip this step and just stay with the default? What benefits will Gunicorn give me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Gunicorn 已做好生产准备并且非常易于使用。我将它用于我的网站。您通常应该通过 Nginx 等反向代理来运行它。我不确定 Heroku 使用的是什么。你真的应该尝试一下。
根据我的经验,它比 apache 和 apache 更容易使用和配置。 mod_wsgi 和其他类似的设置。
编辑/更新:
作为下面评论的总结,Heroku 已经使用 Nginx 作为反向代理
Gunicorn is production ready and really easy to use. I use it for my websites. You usually should run it via a reverse proxy like Nginx. I'm not sure what Heroku is using. You really should try it.
In my experience it's much easier to use and configure than apache & mod_wsgi, and the other similar setups.
edit/update:
As a summary of the comments below, Heroku already uses Nginx as a reverse proxy
性能更好,安全性和稳定性也可能更好。 Django 的开发 Web 服务器(Heroku 默认使用)并不是真正为生产应用程序服务而设计的。
Much better performance, and probably better security and stability, too. Django's development web server (which is used by Heroku by default) isn't really designed to serve production applications.
django的服务器,是一个开发服务器。它重量轻且易于使用,但不应在生产中使用,因为它尚未准备好用于生产。它无法处理许多请求。此链接 提供了gunicorn、uwsgi 和django 开发服务器之间的比较。
django's server, is a development server . It is light weigh and easy to use but should not be used in production because it is not production ready. it cannot handle many requests. This link offers a comparison between gunicorn, uwsgi and django's development server.