简体   繁体   English

使用uWSGI Emperor Mode部署两个python应用程序

[英]Using uWSGI Emperor Mode to deploy two python applications

Hey I'm having trouble figuring out how to use uWSGI emperor mode with my application. 嘿,我在弄清楚如何在应用程序中使用uWSGI皇帝模式时遇到了麻烦。 I made two applications but the problem is I have no idea how to use uWSGI in itself or in emperor mode :( Can someone tell me what i need or point me to something useful. Also do I have to use nginx because everytime I google uWSGI it always uses nginx. 我做了两个应用程序,但问题是我不知道如何在自身或皇帝模式下使用uWSGI :(有人可以告诉我我需要什么或将我指向有用的东西吗。我还必须使用nginx,因为每次我用Google uWSGI进行搜索时它始终使用nginx。

Nginx is not the only web server or the official web server to use for your application. Nginx不是用于您的应用程序的唯一Web服务器或官方Web服务器。

There are some great alternatives to it and you should explore those to understand the pros and cons of it. 有很多很好的替代方法,您应该探索那些方法,以了解其优缺点。 Some of the alternatives are Apache HTTP Server , lighttpd , etc. 一些替代方法是Apache HTTP Serverlighttpd等。

Nginx(a web server) faces the outside world. Nginx(Web服务器)面向外部世界。 However, it cannot directly talk to flask application; 但是,它不能直接与flask应用程序通信。 it needs something that will run the application, feed it requests from web clients(such as the browser) and return responses. 它需要一些东西来运行该应用程序,从Web客户端(例如浏览器)接收它的请求并返回响应。

uWSGI is a WSGI( Web Server Gateway Interface ) implementation, which does this job. uWSGI是WSGI( Web服务器网关接口 )实现,可完成此任务。

I am assuming that you are using UNIX like system. 我假设您正在使用UNIX之类的系统。 So, we need to create UNIX socket and serve responses to the webserver via WSGI protocol. 因此,我们需要创建UNIX套接字并通过WSGI协议将响应提供给Web服务器。

The complete stack will look something like this : 完整的堆栈如下所示:

the web client <-> the web server <-> the socket <-> the uwsgi <-> flask

This is to give you basic understanding of how this stack works. 这是为了使您对堆栈的工作原理有基本的了解。

You can refer to the detailed configuration to setup this stack on this link . 您可以参考详细配置以在此链接上设置此堆栈。

Once you setup the stack, you can easily configure it run in emperor mode to server multiple python applications using a config file. 设置堆栈后,您可以轻松地将其配置为以皇帝模式运行,以使用配置文件为多个python应用程序提供服务器。 This blog post will help you in achieving that. 这篇博客文章将帮助您实现这一目标。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM