我更新了wsgi.py使其看起来像这样:
import os
import sys
import site
site.addsitedir(os.path.join('/home/ubuntu/ve','project/lib/python2.6/site-packages'))
sys.path.append(os.path.abspath(os.path.dirname(__file__)))
sys.path.append(os.path.join(os.path.realpath(os.path.dirname(__file__)), '../../../'))
sys.path.append(os.path.join(os.path.realpath(os.path.dirname(__file__)), '../../'))
os.environ['DJANGO_SETTINGS_MODULE'] = 'project.configs.staging.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
我的uwsgi.conf文件现在看起来像这样:
# file: /etc/init/uwsgi.conf
description "uWSGI starter"
start on (local-filesystems and runlevel [2345])
stop on runlevel [016]
respawn
# home - is the path to our virtualenv directory
# pythonpath - the path to our django application
# module - the wsgi handler python script
exec /home/ubuntu/ve/project/bin/uwsgi \
--uid ubuntu \
--pythonpath /home/ubuntu/django-projects/project/project/configs/staging \
-H /home/ubuntu/ve/project \
--socket /tmp/uwsgi.sock \
--chmod-socket 644 \
--module wsgi \
--logdate \
--optimize 2 \
--processes 2 \
--master \
--logto /home/ubuntu/logs/project/uwsgi.log
# file: /etc/Nginx/sites-available/yourdomain.com
# Nginx configuration for project.maumercado.com
server {
listen 80;
charset utf-8;
server_name project.maumercado.com;
access_log /home/ubuntu/logs/project/Nginx/access.log;
error_log /home/ubuntu/logs/project/Nginx/error.log;
location ^~ /cache/ {
root /home/ubuntu/django-projects/project/project/media;
expires max;
}
location / {
uwsgi_pass unix:/tmp/uwsgi.sock;
include /etc/Nginx/uwsgi_params;
}
}
现在它的工作非常完美,我在样式方面遇到了一些问题,因为在css文件中使用了像ñ这样的奇怪字符。
现在,我想知道当需要使用uwsgi在同一服务器上运行更多项目时该怎么办?