安装uwsgi
使用pip直接安装。
$ pip install uwsgi
测试uwsgi
写一个test.py
def application(env, start_response):
start_response('200 OK', [('Content-Type','text/html')])
return ["Hello World"]
注意:
如果是python3,需要返回bytes 型列表,否则页面没有内容。
return [b"Hello World"]
然后执行shell命令:
uwsgi --http :8001 --wsgi-file test