python flask 项目上线
----启动文件 restart.sh -------
#!/bin/bash
killall gunicorn
cd /data/www/xiaoguan/ && venv/bin/gunicorn -D app:app
----- 项目根目录 gunicorn.conf.py ------
import os
from dotenv import load_dotenv
# import multiprocessing
for env_file in ('.env', '.flaskenv'):
env = os.path.join(os.getcwd(), env_file)
if os.path.exists(env):
load_dotenv(env)
bind = "0.0.0.0:8881"
workers = 4
reload = True
accesslog = "/data/www/xiaoguan/logs/xiaoguan_access.log"
# disable_redirect_access_to_syslog = True
# access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"'
errorlog = "/data/www/xiaoguan/logs/xiaoguan_error.log"