Python 配置wsgi接口
# 引入Python wsgi包
from wsgiref.simple_server import make_server # 撰写服务器端程序代码
def Application(envirn,start_response):
start_response('200 ok',[('Content-Type','text/html')])
return '<b>hello world</b>' # 实例化一个监听8080端口的服务器
server = make_server('',8080,Application) # 开始监听http请求
server.serve_forever()

wsgi是将Python服务器端程序链接到web服务器的通用协议

Nginx+uwsgi配置

安装Nginx

brew install nginx

brew services start nginx

Python web服务器-LMLPHP

Nginx 配置文件

进入/usr/local/etc/nginx目录下,执行 sudo vim nginx.conf

参考:http://www.cnblogs.com/Lxiaolong/p/4201973.html

安装uwsgi及配置

pip install uwsgi

参考:http://www.cnblogs.com/sky20081816/p/3398864.html

04-16 18:40
查看更多