Hi guys,
   I hit a problem when using nginx+uwsgi to serve two mezzanine sites upon 
one VPS.
I use virtualenvwrapper to create a env with python2.7.6, note that 
system(centos6.5) has default python2.6.

Here is my uwsgi.xml:
<uwsgi>
  <socket>127.0.0.1:9000</socket>
  <listen>100</listen>
  <master>true</master>
  <pidfile>/usr/local/nginx/uwsgi.pid</pidfile>
  <processes>8</processes>
  <pythonpath>/home/Portal</pythonpath>
  <pythonpath>/home</pythonpath>
  <module>wsgi</module>
  <profiler>true</profiler>
  <memory-report>true</memory-report>
  <enable-threads>true</enable-threads>
  <logdate>true</logdate>
  <limit-as>6048</limit-as>
  <daemonize>/home/django.log</daemonize>
</uwsgi>

here is django uwsgi files included in nginx conf:
1. django_uwsgi.xml:
server {
        listen  80;
        server_name happydiaosi.com;
        location / {
            uwsgi_pass   127.0.0.1:9000;
            include     uwsgi_params;
            uwsgi_param UWSGI_CHDIR /home/Portal;
            uwsgi_param UWSGI_SCRIPT wsgi;
            uwsgi_param UWSGI_PYHOME /home/pyvirenvs/py276;
            #uwsgi_param UWSGI_PYHOME /home/pyvirenvs/easonportal;
            #uwsgi_param UWSGI_PYHOME /usr/lib64/python2.6;
           access_log  off;
        }
        location /static/ {
        root            /home/Portal/;
        access_log      off;
        log_not_found   off;
        autoindex on;
    }
 }

2. django_uwsgi2.xml 
# Django project
server {
        listen  80;
        server_name eason.happydiaosi.com;
        location / {
            uwsgi_pass   127.0.0.1:9000;
            include     uwsgi_params;
            uwsgi_param UWSGI_CHDIR /home/EasonPortal;
            uwsgi_param UWSGI_SCRIPT wsgi;
            uwsgi_param UWSGI_PYHOME /home/pyvirenvs/py276;
            #uwsgi_param UWSGI_PYHOME /home/pyvirenvs/easonportal;
            #uwsgi_param UWSGI_PYHOME /usr/lib64/python2.6;
           access_log  off;
        }
        location /static/ {
        root            /home/EasonPortal/;
        access_log      off;
        log_not_found   off;
    }
 }

So, after I start uwsgi and nginx, when access from browser, it raises:
Traceback (most recent call last):
  File "/home/EasonPortal/wsgi.py", line 16, in <module>
    from django.core.wsgi import get_wsgi_application
ImportError: No module named django.core.wsgi

actually, within the py276, I can import .
So,here is sys.path of py276: 
(py276)[root@show python2.7]# python
Python 2.7.6 (default, Aug 27 2014, 02:35:36) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
[31326 refs]
>>> sys.path
['', '/home/pyvirenvs/py276/lib/python27.zip', 
'/home/pyvirenvs/py276/lib/python2.7', 
'/home/pyvirenvs/py276/lib/python2.7/plat-linux2', 
'/home/pyvirenvs/py276/lib/python2.7/lib-tk', 
'/home/pyvirenvs/py276/lib/python2.7/lib-old', 
'/home/pyvirenvs/py276/lib/python2.7/lib-dynload', 
'/usr/local/lib/python2.7', '/usr/local/lib/python2.7/plat-linux2', 
'/usr/local/lib/python2.7/lib-tk', 
'/home/pyvirenvs/py276/lib/python2.7/site-packages']

And, here is output from wsgi.py(I add code to print sys.path in wsgi.py):
********************************************************************************
['/home/pyvirenvs/py276/lib/python2.6', '/home/EasonPortal', 
'/usr/lib64/python26.zip', '/usr/lib64/python2.6', 
'/usr/lib64/python2.6/plat-linux2', '/usr/lib64/python2.6/lib-tk', 
'/usr/lib64/python2.6/lib-old', '/usr/lib64/python2.6/lib-dynload', 
u'/home']
********************************************************************************

So, why the path for wsgi looks like above? why everytime pointed to 
python26 which doesn't exist,say,/home/pyvirenvs/py276/lib/python2.6,
it should be python2.7 under /home/pyvirenvs/py276/lib, not python2.6...

What wrong here? Anything wrong with my uwsgi.xml or django_uwsgi.conf 
files?

Thanks.
Wesley

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to