1.静态文件收集
setting.py
static_root = ''
python manage.py collectstatic
2.进入虚拟环境
cd到venv/bin中
source activate
退出虚拟环境
deactivate
3.安装uWSGI
sudo apt-get install uwsgi
4.创建uwsgi.ini
注意要与manage.py同级
touch uwsgi.ini
5.配置uWSGI
[uwsgi]
# Django-related settings
# the base directory (full path)
chdir = /home/ubuntu/ranci
dhfkjadshfsdfasdf Django's wsgi file
module = warnproject.wsgi:application
# the virtualenv (full path)
home = /home/ubuntu/ranci/venv
# process-related settings
# master
master = true
# maximum number of worker processes
processes = 4
threads = 2
# the socket (use the full path to be safe
socket = 1010
# ... with appropriate permissions - may be needed
# chmod-socket = 664
# clear environment on exit
vacuum = true
pidfile=uwsgi.pid
daemonize=uwsgi.log
6.运行uWSGI
uwsgi uwsgi.ini #运行uwsgi服务
uwsgi --reload uwsgi.ini #重新载入uwsgi服务
uwsgi --stop uwsgi.ini #停止uwsgi服务
7.查看uWSGI是否在运行
ps -ef|grep uwsgi