django需要gunicorn来服务REST吗?

问题描述 投票:0回答:1

django本身不会从Web服务器(Nginx)提供REST调用。如果django本身可以做到这一点,为什么Gunicorn需要。

django rest django-rest-framework gunicorn wsgiserver
1个回答
0
投票

通过“django本身”我假设你的意思是开发服务器?基本的答案是开发服务器只是用于开发,而Gunicorn是一个生产就绪的HTTP服务器,可以很好地与Python / Django连接。

例如,你可以在没有Nginx的情况下运行Gunicorn。此外,还添加了Nginx,主要用于提供静态文件和/或管理传入请求,从而减轻了Gunicorn应用程序服务器的压力。

请参阅此文章,了解Gunicorn + Nginx组合的非常好的描述:https://www.digitalocean.com/community/tutorials/how-to-deploy-python-wsgi-apps-using-gunicorn-http-server-behind-nginx

© www.soinside.com 2019 - 2024. All rights reserved.