First up, stop loading mod_python into Apache. It is using a different Python 
version and is likely the cause of all the problems as you cannot use both 
mod_python and mod_wsgi together when they are using different Python versions.

Second, if you mean you installed Python 2.7.7 from source code and at the same 
time you still had a system Python 2.7 of a different patch level revision, 
then mod_wsgi.so is linked against the shared library from the wrong Python 
installation>

Your mod_wsgi.so should be loading libpython2.7.so from /usr/local/lib.

You should go back into mod_wsgi source code and do:

make distclean
./configure --with-python=/usr/local/bin/python
LD_RUN_PATH=/usr/local/lib make
sudo make install

Check again whether ldd is picking up the wrong library.

There also should be no need to list /usr/local/lib/python2.7/site-packages in 
python-path.

When using an alternate Python installation under /usr/local and a global one 
is being picked up instead, use:

WSGIPythonHome /usr/local

Albeit that this will not work if mod_python is also loaded even if using the 
same Python version. Another reason why you shouldn't use mod_python at same 
time.

Also, if you are using a Python virtual environment as well, which is correctly 
built from the Python 2.7.7 under /usr/local, then you can drop the sys.path 
fixes up in your WSGI script file for having it be used and instead simply use:

WSGIDaemonProcess holding python-home=/var/www/html/holding

where python-home is set to the value of sys.prefix for that Python virtual 
environment.

Graham


On 10/06/2014, at 5:06 AM, Helio Gutierrez <[email protected]> wrote:

> Hi 
> 
> I've downloaded Python 2.7.7 and compiled mod_wsgi3.5 with that Python 
> version on Centos 6.5 (Parallel Desktop 11) with Django 1.6.2, but i have an 
> error in my server. 
> 
> I have the next configuration, maybe someone can help me:
> 
> 
> Apache/2.2.15 (Unix) DAV/2 mod_fcgid/2.3.6 mod_python/3.3.1 Python/2.6.6 
> mod_ssl/2.2.15 OpenSSL/1.0.1e-fips mod_wsgi/3.5 Python/2.7.7 mod_perl/2.0.4 
> Perl/v5.10.1 configured -- resuming normal operations
> 
> [root@u16844278 mod_wsgi-3.5]# ldd /usr/lib64/httpd/modules/mod_wsgi.so
>       linux-vdso.so.1 =>  (0x00007fff15fff000)
>       libpython2.7.so.1.0 => /usr/lib64/libpython2.7.so.1.0 
> (0x00007fd1eb3ee000)
>       libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fd1eb1d1000)
>       libdl.so.2 => /lib64/libdl.so.2 (0x00007fd1eafcc000)
>       libutil.so.1 => /lib64/libutil.so.1 (0x00007fd1eadc9000)
>       libm.so.6 => /lib64/libm.so.6 (0x00007fd1eab45000)
>       libc.so.6 => /lib64/libc.so.6 (0x00007fd1ea7b0000)
>       /lib64/ld-linux-x86-64.so.2 (0x00007fd1eba07000)
> 
> 
> vhost.conf:
> 
> WSGIDaemonProcess holding 
> python-path=/var/www/html/holding/src:/usr/local/lib/python2.7/site-packages
> WSGIProcessGroup holding
> 
> WSGIScriptAlias / /var/www/html/holding/src/wsgi.py
> 
> <Location "/">         
>       Order Allow,Deny
>       Allow from all
> </Location>
> 
> Alias /static/admin/  
> /usr/local/lib/python2.7/site-packages/django/contrib/admin/static/admin
>  
> <Location "/static">
>       SetHandler None
> </Location>
>  
> Alias /static/                /var/www/vhosts/mysite.com/holding/static
>  
> <Location "/media">
>       SetHandler None
> </Location>
>  
> Alias /media          /var/www/vhosts/mysite.com/holding/media
>  
> <LocationMatch "\.(jpg|gif|png|css|js)$">
>       SetHandler None
> </LocationMatch>
> 
> 
> 
> wsgi.py
> 
> import os, sys
> 
> sys.path.append('/usr/local/lib/python2.7')
> sys.path.append('/usr/local/lib/python2.7/site-packages')
> 
> sys.path.append('/var/www/html/holding')
> sys.path.append('/var/www/html/holding/src')
> 
> prev_sys_path = list(sys.path)
>  
> # reorder sys.path so new directories from the addsitedir show up first
> new_sys_path = [p for p in sys.path if p not in prev_sys_path]
> for item in new_sys_path:
>     sys.path.remove(item)
> sys.path[:0] = new_sys_path
> 
> 
> os.environ['DJANGO_SETTINGS_MODULE'] = 'src.settings'
> 
> from django.core.wsgi import get_wsgi_application
> application = get_wsgi_application()
> 
> 
> error_log
> 
> [Mon Jun 09 12:49:45 2014] [error] [client 189.219.102.94] mod_wsgi 
> (pid=12642): Target WSGI script '/var/www/html/holding/src/wsgi.py' cannot be 
> loaded as Python module.
> [Mon Jun 09 12:49:45 2014] [error] [client 189.219.102.94] mod_wsgi 
> (pid=12642): Exception occurred processing WSGI script 
> '/var/www/html/holding/src/wsgi.py'.
> [Mon Jun 09 12:49:45 2014] [error] [client 189.219.102.94] Traceback (most 
> recent call last):
> [Mon Jun 09 12:49:45 2014] [error] [client 189.219.102.94]   File 
> "/var/www/html/holding/src/wsgi.py", line 38, in <module>
> [Mon Jun 09 12:49:45 2014] [error] [client 189.219.102.94]     from 
> django.core.wsgi import get_wsgi_application
> [Mon Jun 09 12:49:45 2014] [error] [client 189.219.102.94]   File 
> "/usr/local/lib/python2.7/site-packages/django/core/wsgi.py", line 1, in 
> <module>
> [Mon Jun 09 12:49:45 2014] [error] [client 189.219.102.94]     from 
> django.core.handlers.wsgi import WSGIHandler
> [Mon Jun 09 12:49:45 2014] [error] [client 189.219.102.94]   File 
> "/usr/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 
> 4, in <module>
> [Mon Jun 09 12:49:45 2014] [error] [client 189.219.102.94]     import logging
> [Mon Jun 09 12:49:45 2014] [error] [client 189.219.102.94]   File 
> "/usr/local/lib/python2.7/logging/__init__.py", line 26, in <module>
> [Mon Jun 09 12:49:45 2014] [error] [client 189.219.102.94]     import sys, 
> os, time, cStringIO, traceback, warnings, weakref, collections
> [Mon Jun 09 12:49:45 2014] [error] [client 189.219.102.94] SystemError: 
> dynamic module not initialized properly
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "modwsgi" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/modwsgi.
> For more options, visit https://groups.google.com/d/optout.

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

Reply via email to