在测试uwsgi时,一般会编写如下测试文件
对于python2:
def application(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/html')])
test = 'hello world'
return test
对于python3则应当注意要指明编码,否则uwsgi不会发送网页内容。
def application(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/html')])
test = 'hello world'
return test.encode("utf-8")
#或者 return test.encode("ascii")