Nginx, WSGI, Flask 간 의 관 계 를 어떻게 이해 합 니까?
개술
Nginx,WSGI( uWSGI,uwsgi),Flask( Django), 。 , 。
, HTTP Flask , web ,WSGI ,web , 。 , 。
1:web ,web WSGI
웹 서버 계층
- , , , , 。 , :
Web , HTTP 。 web , web Nginx,Apache,IIS 。 1 ,web , 。
웹 프레임 층
Web web ,HTTP web 。 web Flask,Django , Flask , web :
from flask import Flask
app = Flask(__name__)
@app.route('/hello')
def hello_world():
return 'Hello World!'
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8080)
, web app。app ip 8080 , 。 ,HTTP URL , /hello hello_world ,hello_world ‘Hello World!’ 。 web , HTTP , 。Web , 。
WSGI 계층
WSGI , API, ,WSGI , Python , Web Server Gateway Interface, web web 。 , web web WSGI , web web 。
web web 。
def application(env, start_response):
start_response('200 OK', [('Content-Type', 'text/html')])
return [b"Hello World"]
application web , env,start_response web 。 ,env , HTTP_HOST,HOST_USER_AGENT,SERVER_PROTOCO 。start_response , , status,response_headers。application , http Content-Type , 。
WSGI , WSGI web , application 。WSGI env,start_response , application , 。
,WSGI , :
uwsgi
wsgi ,uWSGI uwsgi
uWSGI
uwsgi WSGI web 。 uWSGI web , web 。
CGI
, Python , web 。 , web ,web web ,web , 。
web CGI ,CGI ( Python ) , , 。WSGI CGI 。
, WSGI web web :WSGI , web web 。 ,Nginx web ,Flask web , ,WSGI Nginx、Flask 。
Nginx,WSGI,Flask 。
**Nginx**:Hey,WSGI, , , Flask 。
**WSGI**:OK,Nginx。 , Flask 。
**Flask**:Thanks WSGI! , 。
**WSGI**:Alright, 。
**Flask**:Okay, , , Nginx。
** WSGI**:Good job!Nginx, , 。
** Nginx**:Cool, , 。 ~
:
http://hackerxu.com/2015/05/10/flask011.html
https://www.quora.com/What-are-good-ways-to-understand-WSGI-flup-fastcgi-CGI-and-Django
https://en.wikipedia.org/wiki/Web_Server_Gateway_Interface
http://flask.pocoo.org/docs/0.10/quickstart/
http://stackoverflow.com/questions/219110/how-python-web-frameworks-wsgi-and-cgi-fit-together
https://www.python.org/dev/peps/pep-0333/
《Python ( 3 )》Wesley Chun
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Portswigger의 연구실 작성: CSRF 토큰 보호를 사용한 기본 클릭재킹이 견습생 수준 실습에서는 일부 CSRF 토큰 보호가 있음에도 불구하고 클릭재킹에 취약한 웹사이트에서 계정 삭제 흐름을 악용합니다. 주어진 자격 증명으로 로그인하면 계정 페이지로 이동한 후 사용자 계정을 삭제하는 데...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.