WSGI

1 개요[ | ]

Web Server Gateway Interface (WSGI), Python WSGI
웹서버 게이트웨이 인터페이스, 파이썬 WSGI
  • 웹서버와 웹 애플리케이션의 인터페이스를 위한 파이선 프레임워크
  • 웹서버가 웹어플리케이션과 어떻게 커뮤니케이션 하는지에 대한 명세
  • 명세의 목적은 각각의 다른 서버에서 Python 어플리케이션 호스팅을 위한 공통의 메카니즘 제공
  • 웹서버가 웹어플리케이션이 요청에 대한 처리를 어떻 잘 서로잘 연결 되어 있는지에 대한 명세
  • Python 표준문서: PEP 333 -- Python Web Server Gateway Interface v1.0

2 애플리케이션 예시[ | ]

def application(environ, start_response):
    start_response('200 OK', [('Content-Type', 'text/plain')])
    yield 'Hello World\n'
  • 1행: environstart_response를 매개변수를 가지는 callable 선언environ은 환경변수를 가지고 있는 딕셔너리
start_responsestatusresponse_headers를 가지는 callable임
  • 2행: start_response 호출
  • 3행: 문자열 반환

3 같이 보기[ | ]

4 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}