UWSGI

1.基础环境准备好

yum groupinstall "Development tools"

yum install zlib-devel bzip2-devel pcre-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel

 

2.准备好python3环境

 

3.准备好virtualenv

 

4.安装uWSGI

1.激活虚拟环境

source /opt/all_venv/venv2/bin/activate

 

2.安装uWSGI

(venv2) [root@s13linux ~ 05:18:21]$pip3 install uwsgi

 

3.检查uwsgi版本

(venv) [root@slave 192.168.11.64 /opt]$uwsgi --version

2.0.17.1

#检查uwsgi python版本

uwsgi --python-version

 

4.运行一个简单的uwsgi服务器

1.创建一个test.py文件,写入内容

def application(env, start_response):

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

return [b"Hello World"] # python3

 

2.然后用uwsgi命令启动

uwsgi --http :8000 --wsgi-file test.py

参数解释

http :8000: 使用http协议,端口8000

wsgi-file test.py: 加载指定的文件,test.py

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

搜索

posted @ 2018-11-09 08:22  步履阑珊  阅读(788)  评论(0编辑  收藏  举报