python最簡單的wsgi例子

from wsgiref.simple_server import make_serverhtml


def application(environ, start_response):web

    start_response('200 OK', [('Content-Type', 'text/html')])app

    body = '<h1>Hello, %s!</h1>' % (environ['PATH_INFO'][1:] or 'web')code

    return [body.encode('utf-8')]server

httpd = make_server('',8001,application)htm

print('Serving HTTP on port 8001......')utf-8

httpd.serve_forever()io

相關文章
相關標籤/搜索