WEB框架之wsgi框架

#_author:来童星
#date:2020/2/20
#wsgi 框架
from wsgiref.simple_server import make_server
#environ为一个对象,封装了客户端的请求信息
#start_response为服务器发送给浏览器(客户端)的响应信息
def application(environ,start_response):
start_response("200 ok ",[('Content-Type','text/html')])
return [b"<h1>hello star</h>"]

httpd=make_server('',8080,application)
print('sereing HTTP is running on port 8080 ')

#开始监听HTTP请求
httpd.serve_forever()

猜你喜欢

转载自www.cnblogs.com/startl/p/12336429.html