Hi folks,

I'm trying to configure my mod_wsgi 2.5 to allow virtual Python
environments, as described on the wiki[1].

I decided to go with a Python baseline, so I took the following steps:

 1. created a virtual environment at /usr/local/baseline (with --no-
site-packages)
 2. placed `WSGIPythonHome /usr/local/baseline` at the bottom of my
apache2.conf file[2]
 3. restarted Apache
 4. attempted to load the page and import the `django` module
 5. loading the module was rather too successful for the empty
baseline environment, and at restart I got:

  [Fri Jul 03 12:08:11 2009] [warn] mod_wsgi: Python module path '/usr/
lib/python2.5/:/usr/lib/python2.5/plat-linux2:/usr/lib/python2.5/lib-
tk:/usr/lib/python2.5/lib-dynload'.

Here's where the problem exists.  I'm successful in importing the
django module that's installed on the system's main Python
configuration.  My understanding was that defining a `WSGIPythonHome`
would override the system's Python and make all packages installed
there unavailable.

I modified the WSGI file that was being called to return an exception
with the Django version and the current sys.path, which I could then
view in the Apache log:

  Exception: ((1, 0, 2, 'final', 0), ['/usr/lib/python2.5/site-
packages/pip-0.3dev-py2.5.egg', '/usr/lib/python2.5/site-packages/
virtualenv-1.3.2-py2.5.egg', '/usr/lib/python2.5/site-packages/
virtualenvwrapper-1.8.1-py2.5.egg', '/usr/lib/python2.5/site-packages/
Trac-0.11.4-py2.5.egg', '/usr/lib/python2.5/site-packages/Genshi-0.5.1-
py2.5-linux-i686.egg', '/usr/lib/python2.5/site-packages/
TracMercurial-0.11.0.7-py2.5.egg', '/usr/lib/python2.5/site-packages/
agilo-0.7.4.1_r1624_20090611-py2.5.egg', '/usr/lib/python2.5/site-
packages/ReviewBoard-1.0-py2.5.egg', '/usr/lib/python2.5/site-packages/
pytz-2009j-py2.5.egg', '/usr/lib/python2.5/site-packages/
flup-1.0.3.dev_20090612-py2.5.egg', '/usr/lib/python2.5/site-packages/
Pygments-1.0-py2.5.egg', '/usr/lib/python2.5/site-packages/Djblets-0.5-
py2.5.egg', '/usr/lib/python2.5/site-packages/django_evolution-0.0.0-
py2.5.egg', '/usr/lib/python2.5/site-packages/Django-1.0.2_final-
py2.5.egg', '/usr/lib/python2.5/site-packages/PIL-1.1.6-py2.5-linux-
i686.egg', '/usr/lib/python2.5/site-packages/TracWysiwyg-0.2_r5931-
py2.5.egg', '/usr/lib/python2.5', '/usr/lib/python2.5/plat-linux2', '/
usr/lib/python2.5/lib-tk', '/usr/lib/python2.5/lib-dynload', '/usr/
local/lib/python2.5/site-packages', '/usr/lib/python2.5/site-
packages', '/var/lib/python-support/python2.5', '/usr/lib/python2.5/
site-packages'])

So there I've placed my virtual environment as Python home, but `/usr/
lib/python2.5/` is still being used.

I wanted to make sure `www-data` had access to this directory, so I
tried:

  frid...@encom:/etc/apache2/mods-enabled$ sudo su www-data
  sh-3.2$ source /usr/local/baseline/bin/activate
  (baseline)sh-3.2$

I don't seem to have any means of debugging what's happening or not
happing with the `WSGIPythonHome` directive when it's interpreted,
because it seems that whatever path I put there (however valid), it
doesn't log a single thing even in `LogLevel debug` mode.

`mod_python` is not enabled (it was mentioned that it would interfere
with WSGIPythonHome, making it ineffective), this is my `mods-enabled`
folder: alias.conf, alias.load, auth_basic.load, authn_file.load,
authz_default.load, authz_groupfile.load, authz_host.load,
authz_user.load, autoindex.conf, autoindex.load, cgid.conf, cgid.load,
deflate.conf, deflate.load, dir.conf, dir.load, env.load, mime.conf,
mime.load, negotiation.conf, negotiation.load, setenvif.conf,
setenvif.load, status.conf, status.load, wsgi.conf, wsgi.load

I'd appreciate any suggestions that could help troubleshoot this,
Friðrik Már

[1] http://code.google.com/p/modwsgi/wiki/VirtualEnvironments
[2] This is used in the Debian Apache hierarchy, and is essentially
the main config file, equal to httpd.conf in some distributions. At
any rate, this is loaded before any WSGIScriptAlias call.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to