from wsgiref.simple_server import make_server def application(environ, start_response): start_response('200 OK', [('Content-type', 'text/html')]) print(environ) path=environ['PATH_INFO'] #注意PATH_INFO中间的下划线 if path=="/book": return [b'xxxx'] elif path=="/phone": return [b'xxxxx'] else: return [b'<h1>404</h1>'] httpd = make_server('127.0.0.1', 8080, application) #地址要用引号引起来,端口不用 httpd.serve_forever()
Python:Day51 web框架
猜你喜欢
转载自www.cnblogs.com/sq5288/p/8945549.html
今日推荐
周排行