ubuntu 14.04
cd /var/www
mkdir testing
cd testing
virtualenv venv --python=python3
. venv/bin/activate
pip install mezzanine
mezzanine-project cmsapp
cd cmsapp
python manage.py createdb --nodata
Python manage.py collectstatic
pip install uwsgi
vim uwsgi.ini 内容如下
[uwsgi]
# the socket (use the full path to be safe
socket = /var/www/testing/cmsapp/nginx.sock
# the base directory (full path)
chdir = /var/www/testing/cmsapp
module = cmsapp.wsgi #注意该文件在磁盘上并不存在
# process-related settings
master = true
# maximum number of worker processes
processes = 2
threads = 2
# with appropriate permissions
chmod-socket = 666
# clear environment on exit
vacuum = true
vim start.sh 内容如下:
#!/bin/bash
echo 'Start uwsgi Now ...'
/var/www/testing/venv/bin/uwsgi --ini /var/www/testing/cmsapp/uwsgi.ini &
echo 'Start uwsgi success!'
vim close.sh 内容如下:
#!/bin/bash
echo 'Close uwsgi Now ...'
ps -ef|grep uwsgi| grep -v grep|cut -c 7-15|xargs sudo kill -9
echo 'Close uwsgi success!'
nginx.conf的server配置如下:
location /static {
alias /var/www/testing/cmsapp/static;
}
location / {
include uwsgi_params;
uwsgi_pass unix:/var/www/testing/cmsapp/nginx.sock;
uwsgi_param UWSGI_PYHOME /var/www/testing/venv; #可能并不需要,没有验证
}