In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "the process of Python Web program deployment using uWSGI". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "the process of deploying Python Web programs using uWSGI".
What is it that the Python Web program uses uWSGI to deploy WSGI?
WSGI, or Web Server Gateway Interface, or Python Web Server Gateway Interface, is a simple and general interface between a Web server and a Web application or framework defined for the Python language. Since WSGI was developed, similar interfaces have appeared in many other languages.
The official definition of WSGI is the Python Web Server Gateway Interface. As can be seen from the name, this thing is a Gateway, that is, a gateway. The function of the gateway is to convert between protocols.
WSGI is used as a low-level interface between Web server and Web application or application framework to enhance the common ground of portable Web application development. WSGI is designed based on existing CGI standards.
Many frameworks come with WSGI server, such as Flask,webpy,Django, CherryPy, and so on. Of course, the performance is not good, the built-in web server is more for testing purposes, and the uwsgi is released using the WSGI server of the production environment or the joint nginx. In other words, WSGI is like a bridge between a web server (such as nginx) on one side and Python's application Application on the other. However, the function of this bridge is very weak, and sometimes other bridges are needed to deal with it.
UWSGI
UWSGI is a (huge) C application, so you need a C compiler (such as gcc or clang) and a Python development header file.
UWSGI is a Web server, which implements WSGI protocol, uwsgi, http and other protocols. The role of HttpUwsgiModule in Nginx is to exchange with the uWSGI server.
UWSGI installation environment SystemOS: CentOS-7.5_x64Python: 3.6virtual: Anaconda3 installation # install $pip install uwsgiuWSGI hello world directly in the virtual environment
Hello_world.py
Def application (env, start_response): start_response ('200 OK', [(' Content-Type','text/html')]) return [b "Hello World"]
Start
Uwsgi-- http 0.0.0.0 wsgi-file hello_world.py 8000
Use a browser to access http://ip:8000
Multiple parameters can be added by starting uwsgi
Uwsgi-- socket 127.0.0.1 processes 3031-- wsgi-file uwsgi.py-- master-- processes 4-- threads 2-- stats 127.0.0.1
Write the configuration file centrally in the configuration file
Uwsgi.ini
[uwsgi] socket = 127.0.0.1:3031chdir = / home/foobar/myproject/pythonpath =.. processes = 4threads = 2stats = 127.0.0.1 home/foobar/myproject/pythonpath 9191 here, I believe you have a deeper understanding of "the process of deploying Python Web programs using uWSGI". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.