1.靜態(tài)文件收集
setting.py
static_root = ''
python manage.py collectstatic
2.進入虛擬環(huán)境
cd到venv/bin中
source activate
退出虛擬環(huán)境
deactivate
3.安裝uWSGI
sudo apt-get install uwsgi
4.創(chuàng)建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