官方文档
https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/gunicorn/
小栗子
http://git.oschina.net/lvsmart/ProductStorage
shell脚本
#!/bin/bash
source /home/ubuntu/env/product_storage/bin/activate
cd /home/ubuntu/work/product_storage
sudo /home/ubuntu/env/product_storage/bin/gunicorn -b 0.0.0.0:8002 --access-logfile=/home/ubuntu/product_storage.log --threads=4 --log-syslog --reload -w 1 ProductStorage.wsgi:application --daemon
分析
这是一个shell脚本(文件名:run_storage.sh)
启动方式
./run_storage.sh
使用了virtualenv
https://virtualenv.pypa.io/en/stable/
所以有
source /home/ubuntu/env/product_storage/bin/activate
gunicorn配置说明
http://docs.gunicorn.org/en/stable/settings.html
我这里使用了最基本的配置。简单设置了address,thread,worker 和 log。