【问题标题】:Should I use django-gunicorn integration or wsgi?我应该使用 django-gunicorn 集成还是 wsgi?
【发布时间】:2013-03-01 02:25:54
【问题描述】:

我正在使用 gunicorn + django 设置一个 Web 服务器。有两种部署选项:要么使用常规 WSGI,要么使用 gunicorn 的 django-integration。我很想使用后者,因为它简化了配置,但django documentation 是这样说的:

If you are using Django 1.4 or newer, it’s highly recommended to simply run your
application with the WSGI interface using the gunicorn command as described above.

他们没有给出任何解释,所以我想知道为什么“强烈推荐”使用 WSGI?有什么想法吗?

非常感谢。

【问题讨论】:

    标签: django gunicorn django-wsgi


    【解决方案1】:

    从 Django 1.4 开始,您的项目将已经有一个 wsgi.py,它可以与任何 wsgi 服务器一起使用(其中有很多,gunicorn 只是其中之一)。

    本质上,gunicorn 的旧 Django 集成只是为了让您更快地启动和运行,但它不再需要,因为所有 Django 项目现在都有 wsgi.py

    【讨论】:

    • 好的,谢谢。只有一件事:两者之间有性能差异吗?
    • 我不确定,但我不希望有。
    猜你喜欢
    • 2012-09-09
    • 2012-08-17
    • 2015-10-01
    • 2012-02-16
    • 1970-01-01
    • 2021-10-22
    • 2021-01-02
    • 2018-09-05
    • 1970-01-01
    相关资源
    最近更新 更多