[uWSGI] Virtual Hosting question

James unbit at scottisheyes.com
Tue Jul 13 01:21:18 CEST 2010


My apologies if this shows up as a duplicate on the mailing list - I sent it
in a few days ago, but it never showed up, so I am trying to post it again.
 Thanks!

---------------------

Based on http://projects.unbit.it/uwsgi/wiki/VirtualHosting, I have tried to
configure uwsgi to host multiple Django websites in a single uwsgi instance
(via nginx) - and each django website exists within its own virtualenv.  My
uwsgi command line:

uwsgi -s /tmp/uwsgi-subdomain.sock --vhost --no-site -C -M -p4

------------------------
My nginx config:

upstream subdomain_upstream {
    server unix:///tmp/uwsgi-subdomain.sock;
}

server {
    listen       80;
    server_name  subdomain.example.ca;

    root /home/www/subdomain/project/static;

    location / {
        uwsgi_pass subdomain_upstream;
        include uwsgi_params;
        uwsgi_param SCRIPT_NAME /;
        uwsgi_param UWSGI_SCRIPT subdomain;
        uwsgi_param UWSGI_PYHOME /home/www/subdomain/;
    }
}


-------------------
In /home/www/subdomain/subdomain.py, I have:

import os, sys

PATH_BASE = os.path.dirname(os.path.abspath(__file__))
PATH_PROJECT = os.path.join(PATH_BASE, 'project')

sys.path.append(PATH_PROJECT)
sys.path.append(PATH_BASE)

os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()


---------------------
Finally, my settings.py exists at /home/www/subdomain/project/settings.py.

Now, the error I am getting from uwsgi on a page hit is as follows - it
seems as though paths aren't configured correctly, but I've tried a variety
of things:

[uWSGI DEBUG] uwsgi payload size: 908 (0x38C) modifier1: 0 modifier2: 0
[uWSGI DEBUG] PATH_INFO=/
[uWSGI DEBUG] SCRIPT_NAME=/
[uWSGI DEBUG] setting dynamic virtualenv to /home/www/subdomain/
interpreter for app 0 initialized.
ImportError: No module named subdomain


Can someone suggest what I am doing wrong?

Regard,
James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.unbit.it/pipermail/uwsgi/attachments/20100712/8efec09a/attachment.htm 


More information about the uWSGI mailing list