Article Directory
python WSGI
A, WSGI
1. Definitions
WSGI is the Web Server Gateway Interface for short. It is not a server, python modules, frameworks, API, and any kind of software. It is just an interface specification between a server and applications.
Second, run WSGI service
Write a server.py
# server.py
# 从wsgiref模块导入:
from wsgiref.simple_server import make_server
# 导入我们自己编写的application函数:
def application(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/html')])
return [b'<h1>hello world!</h1>']
a=8080
httpd=make_server('',a,application)
httpd.serve_forever()
run
Enter your browser to http: // localhost: 8080 / can see the results