1.基礎環境準備好html
yum groupinstall "Development tools"python
yum install zlib-devel bzip2-devel pcre-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devellinux
2.準備好python3環境sql
3.準備好virtualenv服務器
4.安裝uWSGIapp
1.激活虛擬環境sqlite
source /opt/all_venv/venv2/bin/activatehtm
2.安裝uWSGIip
(venv2) [root@s13linux ~ 05:18:21]$pip3 install uwsgissl
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
搜索