SmallerPig / modwsgi

Automatically exported from code.google.com/p/modwsgi
0 stars 0 forks source link

WSGIPythonHome seems to be ignored #304

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I have several instances of python installed on my system.  I've compiled 
mod_wsgi against the version that I would like to use for Django that is in the 
directory /opt/Python-2.7.  I've confirmed this by running ldd on the 
mod_wsgi.so file:

[jgbaum@tools-int-01 bin]$ ldd /etc/httpd/modules/mod_wsgi.so 
    linux-vdso.so.1 =>  (0x00007fff760dd000)
    libpython2.7.so.1.0 => /opt/Python-2.7/lib/libpython2.7.so.1.0 (0x00002b0dfde33000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b0dfe1fb000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00002b0dfe418000)
    libutil.so.1 => /lib64/libutil.so.1 (0x00002b0dfe61c000)
    libm.so.6 => /lib64/libm.so.6 (0x00002b0dfe81f000)
    libc.so.6 => /lib64/libc.so.6 (0x00002b0dfeaa3000)
    /lib64/ld-linux-x86-64.so.2 (0x0000003ed5c00000)

I have set the WSGIPythonHome directive to /opt/Python-2.7 and I have set it 
outside any virtualhost directives.  However, the Django apps appear to be 
using the system python at /usr/bin, as the sys.executable variable is 
/usr/bin/python.  I have also tried setting the PYTHONHOME environment variable 
with SetEnv, but that also seems to have no effect.

Any help would be appreciated.  Please let me know if you need more details 
about my setup to debug.

Original issue reported on code.google.com by jgb...@gmail.com on 13 Aug 2013 at 6:01

GoogleCodeExporter commented 8 years ago
If WSGIPythonHome doesn't work, it is normally due to one of a few things.

1. The mod_python module is also being loaded into the same Apache.
2. The wrong path was given to WSGIPythonHome.
3. The directories for the Python installation aren't readable to the user 
Apache runs as.

Set LogLevel to debug in Apache and look for the debug log lines that mod_wsgi 
outputs about trying to setup the Python location.

Original comment by Graham.Dumpleton@gmail.com on 14 Aug 2013 at 12:48

GoogleCodeExporter commented 8 years ago
It seems that the WSGIPyhonHome is actually working.  I was just looking at the 
wrong environment variable.   The issue that we are having is that a python 
script that runs fine from the command line is dying silently under 
Django/Apache + mod_wsgi.  It seems to be dying when unpickling a file without 
throwing an exception or producing a stack trace.  Is there any reason that  
pickle/cPickle would work differently under Django/Apache + mod_wsgi than it 
would from the command line?  As an FYI, the script works just fine if we use 
the building django server as well.

Original comment by jgb...@gmail.com on 17 Aug 2013 at 10:14

GoogleCodeExporter commented 8 years ago
Have you read:

http://code.google.com/p/modwsgi/wiki/IssuesWithPickleModule

There are some limitations with using pickle for objects defined in the WSGI 
script file itself.

Original comment by Graham.Dumpleton@gmail.com on 18 Aug 2013 at 6:21

GoogleCodeExporter commented 8 years ago
Closing as no change was required.

Original comment by Graham.Dumpleton@gmail.com on 16 Sep 2014 at 6:51