Hello,
First, system information:
Ubuntu 13.10
mod_wsgi 3.4 compiled against Python 3.3 (no problems)
Apache 2.4
Seems when I am running my application, mod_wsgi isn't using the correct
interpreter. In my app.wsgi file, I'm outputting the value of
sys.executable to a temp file. When mod_wsgi loads my app file, the path to
the executable should be written out to the file so I can read it. The path
being written out is */usr/bin/python3* instead of
*/home/webuser/projmercury/merc_dev/bin/python3*
I'm setting both the python-home and python-path flags on my DaemonProcess.
The following is from my site configuration in Apache:
WSGILazyInitialization On
WSGIRestrictEmbedded On
Listen 443
<VirtualHost *:443>
ServerName localhost
ServerAlias mercury
SSLEngine on
SSLCertificateFile /etc/ssl/mercury/mercury.crt
SSLCertificateKeyFile /etc/ssl/mercury/mercury.key
WSGIDaemonProcess mercury user=webuser group=webuser \
python-home=/home/webuser/projmercury/merc_dev \
python-path=/home/webuser/projmercury/merc_dev:/home/webuser/projmercury/merc_dev/lib/python3.3/site-packages
\
display-name=%{GROUP}
WSGIProcessGroup mercury
WSGIScriptAlias / /var/www/mercury.wsgi
...
</VirtualHost>
>From the Apache error.log, I'm seeing the following log entries for mod_wsgi
[:debug] [pid 14496:tid 139645645408128] mod_wsgi.c(10488): mod_wsgi
(pid=14496): Socket for 'mercury' is '/var/run/apache2/wsgi.14496.0.1.sock'.
[:info] [pid 14500:tid 139645645408128] mod_wsgi (pid=14500): Starting
process 'mercury' with uid=1000, gid=1000 and threads=15.
[:info] [pid 14500:tid 139645645408128] mod_wsgi (pid=14500): Python home
/home/webuser/projmercury/merc_dev.
[:info] [pid 14500:tid 139645645408128] mod_wsgi (pid=14500): Initializing
Python.
[mpm_worker:notice] [pid 14496:tid 139645645408128] AH00292: Apache/2.4.6
(Ubuntu) mod_wsgi/3.4 Python/3.3.2+ OpenSSL/1.0.1e configured -- resuming
normal operations
[:info] [pid 14500:tid 139645645408128] mod_wsgi (pid=14500): Attach
interpreter ''.
[:info] [pid 14500:tid 139645645408128] mod_wsgi (pid=14500): Adding
'(null)' to path.
[:info] [pid 14500:tid 139645645408128] mod_wsgi (pid=14500): Adding
'/home/webuser/projmercury/merc_dev/lib/python3.3/site-packages' to path.
[:info] [pid 14500:tid 139645489436416] mod_wsgi (pid=14500): Create
interpreter 'localhost|'.
[:info] [pid 14500:tid 139645489436416] mod_wsgi (pid=14500): Adding
'(null)' to path.
[:info] [pid 14500:tid 139645489436416] mod_wsgi (pid=14500): Adding
'/home/webuser/projmercury/merc_dev/lib/python3.3/site-packages' to path.
[:info] [pid 14500:tid 139645489436416] [client 10.113.229.150:2761]
mod_wsgi (pid=14500, process='mercury', application='localhost|'): Loading
WSGI script '/var/www/mercury.wsgi'.
[:info] [pid 14496:tid 139645645408128] mod_wsgi (pid=14500): Process
'mercury' has died, restarting.
[:info] [pid 14579:tid 139645645408128] mod_wsgi (pid=14579): Starting
process 'mercury' with uid=1000, gid=1000 and threads=15.
[:info] [pid 14579:tid 139645645408128] mod_wsgi (pid=14579): Python home
/home/webuser/projmercury/merc_dev.
[:info] [pid 14579:tid 139645645408128] mod_wsgi (pid=14579): Initializing
Python.
[:info] [pid 14579:tid 139645645408128] mod_wsgi (pid=14579): Attach
interpreter ''.
[:info] [pid 14579:tid 139645645408128] mod_wsgi (pid=14579): Adding
'(null)' to path.
[:info] [pid 14579:tid 139645645408128] mod_wsgi (pid=14579): Adding
'/home/webuser/projmercury/merc_dev/lib/python3.3/site-packages' to path.
As you can see, the Python home log entries reflect the correct location,
but the file output shows the wrong interpreter.
My application is running fine but I'm not sure why the wrong interpreter
is being used. I've tried to upgrade to Ubuntu 14.04 and it breaks my app
because python3.4 becomes the default python3 installation (thankfully I
can rollback the VM snapshot to 13.10). Pointing to the interpreter in the
virtual environment via python-home should fix this issue with Ubuntu 14.04
if it would work correctly. Is there something I'm forgetting to configure?
In case you wonder, here are the lines from my mercury.wsgi file:
import sys
with open('/tmp/merc_interpreter','w') as f:
f.write(sys.executable+'\n\n')
Thank you for any assistance.
--
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.