nginx gunicorn flask 部署

重点是service的书写,如下,

#!/bin/bash

start() {
    echo -n "Starting flaskr\n"
    . /root/python_envs/flaskr/bin/activate
    cd /usr/share/nginx/html/flaskr
    gunicorn -w 4 -b 127.0.0.1:8080 flaskr:app > /dev/null &
    echo -n "Start OK!"
}

stop(){
    echo -n "Shutting stop flaskr\n"
    killall gunicorn
    echo -n "flaskr STOP"
}


case "$1" in
start)
    start
;;
stop)
    stop
;;
restart)
    stop && start
;;
esac
exit

再就是python3不支持SQLite3的问题:

网上搜索即可。

1.安装相应sqlite3库。
2.编译安装python3

你可能感兴趣的:(nginx gunicorn flask 部署)