Im trying to setup my django project on a staging server with nginx, virtualenv, and uwsgi, but I keep getting an import module wsgi error.
If theres a community I c
I updated wsgi.py to look like this:
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()
My uwsgi.conf file now looks like this:
# 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
And my nginx site-available file looks like this:
# 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;
}
}
And its working perfect now, I had some problems with the styles because of strange characters being used like ñ in the css files.
Now I would like to know what should I do when I need to run more projects in the same server with uwsgi?