python最简单的wsgi例子
生活随笔
收集整理的這篇文章主要介紹了
python最简单的wsgi例子
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
2019獨角獸企業重金招聘Python工程師標準>>>
from wsgiref.simple_server import make_server
def application(environ, start_response):
? ? start_response('200 OK', [('Content-Type', 'text/html')])
? ? body = '<h1>Hello, %s!</h1>' % (environ['PATH_INFO'][1:] or 'web')
? ? return [body.encode('utf-8')]
httpd = make_server('',8001,application)
print('Serving HTTP on port 8001......')
httpd.serve_forever()
轉載于:https://my.oschina.net/u/2367514/blog/514285
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的python最简单的wsgi例子的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: HTTP 协议中 Vary 的一些研究
- 下一篇: 深夜深思,创业旅途