django - 为什么不再推荐gunicorn_django?

标签 django gunicorn

我们在生产中使用gunicorn_django部署了一个应用程序。我注意到不再推荐它。我想知道为什么不推荐这样做,以及我们是否需要迁移到更新的方式。

来自https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/gunicorn/

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

最佳答案

gunicorn_django 的重要部分 wsgi.py 已集成到 Django 本身中。

引用already existing answer :

Starting with Django 1.4, your project will already have a wsgi.py, which can be used with any wsgi server (of which there are many, gunicorn being just one).

Essentially the old Django integration for gunicorn was just a convenience to get you up and running faster, but it's no longer necessary because all Django projects now have wsgi.py.

更新

首先,在Gunicorn 18.0 gunicorn_django became deprecated .

其次,自从第一次写这个答案以来,我个人遇到了一些晦涩的错误 特定于 gunicorn_django--settings 命令行参数(gunicorn 命令和 ./manage.py runserver 结合使用) > 工作正常)。

即,模糊的导入错误 application.some_model: 'field' 与模型 another_application.AnotherModel 有关系,该模型要么尚未安装,要么是抽象的。

所以,不,我不建议您在新项目中使用 gunicorn_django

关于django - 为什么不再推荐gunicorn_django?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16369354/

相关文章:

python - 使用 django channel 保存数据库更改

javascript - Jquery - 更新背景CSS

python - 将列表转换为查询集

django - 启动gunicorn时如何修复 'ModuleNotFoundError: No module named '主页''?

python - 如何在目录中的文件上运行gunicorn?

django - AWS Elastic Beanstalk +Nginx+Gunicorn

python - 以 django 形式包含验证码

python - 使用 django-celery 进行单元测试?

python - Flask 安装中缺少文件

django - 如何在virtualenv中停止gunicorn_django?