首先安装conda环境
conda create -n env_plotly python=3.8
pip install -i https://pypi.mirrors.ustc.edu.cn/simple/ dash
pip install -i https://pypi.mirrors.ustc.edu.cn/simple/ gunicorn
conda install -c anaconda nginx
配置好conf即可访问:
workers = 4
threads = 2
bind = '127.0.0.1:8050'
daemon = 'false'
worker_class = 'gevent'
worker_connections = 200
pidfile = '/var/run/gunicorn.pid'
assesslog = '/var/log/gunicorn_access.log'
errorlog = '/var/log/gunicorn_error.log'
loglevel = 'warning'
然后运行:
#后台启动
nohup gunicorn -c gunicorn.conf app:server >> log.log 2>&1 &
前台启动
gunicorn -c gunicorn.conf app:server
ps -ef|grep gunicorn|grep -v grep|cut -c 9-15|xargs kill -9
网友评论