uwsgi 启动flask项目

安装库

pip3 install uwsgi

### 启动
uwsgi -d --ini uwsgi.ini

创建 uWSGI 配置文件

[uwsgi]
http=0.0.0.0:5000
chdir=/home/data/webroot/devops_filter/filter
wsgi-file=app.py
callable=app
master=true
workers=3
processes=4
threads=2
uid=knight.zhou
gid=knight.zhou
daemonize=/home/data/webroot/devops_filter/filter/logs/uwsgi.log
pidfile=/home/data/webroot/devops_filter/filter/logs/uwsgi.pid

启动脚本

## prd env

pid=$(ps -ef |grep uwsgi|grep -v grep |wc -l)

if [ $pid -gt 0 ] ; then
    echo "start...."
    /usr/local/python36/bin/uwsgi --ini uwsgi.ini
else
    echo "restart...."
    ps -ef |grep uwsgi|grep -v grep|awk '{print $2}'|xargs kill -9
    /usr/local/python36/bin/uwsgi --ini uwsgi.ini
fi

上一篇:pocsuite用法


下一篇:flask-session