简体   繁体   English

我可以仅使用 nginx 或 Gunicorn 部署我的 Django 应用程序吗?

[英]Can I deploy my Django application only using nginx or Gunicorn?

I knew that for deploying a Django application we have to use a combination of uWSGI + Nginx or Nginx + Gunicorn server.我知道要部署 Django 应用程序,我们必须使用 uWSGI + Nginx 或 Nginx + Gunicorn 服务器的组合。 Is that necessary?那有必要吗? I have a small doubt here.我在这里有一个小疑问。 Can we deploy the entire application only in Nginx or only in Gunicorn?我们可以仅在 Nginx 中或仅在 Gunicorn 中部署整个应用程序吗? Will, it not work?会,它不起作用吗? Just for an example(leaving production) can't I do that?仅举一个例子(离开生产)我不能这样做吗?

For a full pledge application you need both web server and app server.对于完整的质押应用程序,您需要 Web 服务器和应用程序服务器。 Web server such as nginx or apache deliver static content but app server delivers dynamic content. nginxapache等 Web 服务器提供静态内容,而应用程序服务器提供动态内容。 Major differences between a web server and app server are: Web 服务器和应用程序服务器之间的主要区别是:

A web server accepts and fulfills requests from clients for static content (ie, HTML pages, files, images, and videos) from a website. Web 服务器接受并满足客户端对来自网站的静态内容(即 HTML 页面、文件、图像和视频)的请求。 Web servers handle HTTP requests and responses only. Web 服务器仅处理 HTTP 请求和响应。

An application server exposes business logic to the clients, which generates dynamic content.应用服务器向客户端公开业务逻辑,从而生成动态内容。 It is a software framework that transforms data to provide the specialized functionality offered by a business, service, or application.它是一种软件框架,可转换数据以提供业务、服务或应用程序提供的专用功能。 Application servers enhance the interactive parts of a website that can appear differently depending on the context of the request.应用程序服务器增强了网站的交互部分,这些部分可以根据请求的上下文而有所不同。

To know more please follow these link:要了解更多信息,请点击以下链接:

https://www.ibm.com/cloud/learn/web-server-vs-application-server https://www.ibm.com/cloud/learn/web-server-vs-application-server

https://www.educative.io/edpresso/web-server-vs-application-server https://www.education.io/edpresso/web-server-vs-application-server

YES, you can.是的你可以。 NO, you shouldn't.不,你不应该。

If you run your app (in my case Django), on its development server.如果您在其开发服务器上运行您的应用程序(在我的情况下为 Django)。 You can access it from a remote computer at its ip_address:port_number which should look something like 123.142.524.110:8000 and you can see your app at work.您可以从远程计算机的 ip_address:port_number 访问它,它应该类似于 123.142.524.110:8000 并且您可以看到您的应用程序正在工作。

You can also run Django with only gunicorn, it will still lack the web servers capabilities like sering static files efficiently or handling slow clients or DDOS handling.您还可以仅使用 gunicorn 运行 Django,它仍然缺少 web 服务器功能,例如有效地提供 static 文件或处理慢速客户端或 DDOS 处理。 But it will run and that is all I can promise.但它会运行,这就是我所能做的 promise。

Unsure of whether Nginx can be directly tried with DJANGO app server, but I don't see why not.不确定 Nginx 是否可以直接与 DJANGO 应用服务器一起尝试,但我不明白为什么不能。 <<Probably someone else can attest to having successfully 'tried' it>> <<可能其他人可以证明已成功“尝试”过>>

I should repeat again, just coz its possible doesn't mean you should do it.我应该再重复一遍,只是因为它可能并不意味着你应该这样做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在uwsgi或gunicorn无法正常工作的Nginx上部署Django应用 - Deploy django App on nginx with uwsgi or gunicorn not working 如何在生产中使用 gunicorn 和 nginx 托管 2 个 Django 应用程序 - How to host 2 Django Application using gunicorn & nginx in Production 使用Nginx和Gunicorn服务于Django - Using nginx and gunicorn to serve django 如何在Apache代理下部署Django Gunicorn? - How can I deploy Django Gunicorn under Apache proxy? 在django开发环境中使用Docker,Gunicorn,Nginx但只能看到nginx欢迎页面? - Use Docker, Gunicorn, Nginx in django development environment but can only see nginx welcome page? 当我运行wsgi Django项目+ Nginx + Gunicorn时,显示来自Nginx的“欢迎”消息 - 'Welcome' message from Nginx shown when I run my wsgi Django project + Nginx + Gunicorn 具有Nginx和Gunicorn的Django应用程序仅显示欢迎页面,其余所有页面均显示404错误 - Django application with nginx and gunicorn only showing welcome page rest all pages showing 404 error Django可以单独使用Gunicorn(没有Apache或nginx)吗? - Can Django run on Gunicorn alone (no Apache or nginx)? 使用Gunicorn和Nginx部署Django时出现500个内部服务器错误 - 500 internal server error when deploy django with gunicorn and nginx 使用Gunicorn,Nginx和Django的网址解析错误 - URL resolution error using Gunicorn, Nginx, and Django
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM