Presuming that: /home/toinbis/Desktop/programming/project/bin/python
is the Python you wanted used, what do you get when you run that and do: import sys print sys.prefix Whatever the value of sys.prefix is for the Python you want used, add it as: WSGIPythonHome <value of sys.prefix> Replacing <value of sys.prefix> as appropriate. Do not set WSGIPythonExecutable in this case. Alternatively, set: WSGIPythonExecutable /home/toinbis/Desktop/programming/project/bin/python Do not set WSGIPythonHome in this case. If that doesn't help, then also post the output of running: ldd mod_wsgi.so If that doesn't reference a libpython2.6.so from the buildout Python installation, you are going to have to do some trickery. The easiest way is to locate the directory where the correct libpython2.6.so will be installed into and then find the 'envars' file in the same directory as the 'httpd' binary for your buildout installation. Modify that file to include: PATH=<directory containing the correct python executable>:$PATH export PATH LD_LIBRARY_PATH=<directory containing the libpython2.6.so>:$LD_LIBRARY_PATH export LD_LIBRARY_PATH In short though, the basic problem is that you have multiple Python 2.6 installations on the same system and the way Python works it will use as base reference for Python installation the 'python' executable it finds in the PATH use environment variable. For Apache we therefore need to override in the envvars file what PATH is and therefore what Python it finds else it may use system wide installed Python as base. The LD_LIBRARY_PATH is similarly needed where libpython2.6.so is not in a standard library directory. Setting PATH like this avoids need to use either WSGIPythonHome or WSGIPythonExecutable and so you should not set either of those directives for this case. Indicate how that goes and can suggest some other things. Graham 2010/1/21 toinbis <[email protected]>: > Hi everyone! > > Even though i compile mod_wsgi with "--with-python=/path/to/custom/ > python/executable", the system python executable is being used to run > the wsgi app, not the custom one. Is there any setting i'm > misconfiguring in httpd.conf or anywhere else? > > If the the Django framework (python-django Ubuntu package) is not > installed in the system python, the url, triggering the django wsgi > app, ends up with Apache's internal error and `"ImportError: No module > named django.core.handlers.wsgi"` message in apache's error logs. If > django is installed in the system path, it ends up with django pretty > error page: > > ImportError at / > > No module named djangosphinx.models > > Request Method: GET > Request URL: http://127.0.0.1:8001/djangoapp/ > Exception Type: ImportError > Exception Value: > > No module named djangosphinx.models > > Exception Location: /home/toinbis/Desktop/programming/project/src/ > tsd/core/models.py in <module>, line 3 > Python Executable: /usr/bin/python > > So clearly the problem is with using wrong python executable to run > the wsgi app (djangosphinx is a module which is successfully imported > with the zc.buildout custom generated python executable). > > > More background details: > > Am deploying custom nginx + apache(mod_wsgi) + supervisor + mysql + > python + django + php + phpmyadmin + wordpress setup using zc.buildout > (http://buildout.org). Buildout.cfg details: > > > [apache] > recipe = hexagonit.recipe.cmmi > url = http://www.apache.lt/httpd/httpd-2.2.14.tar.gz > keep-compile-dir = true > configure-options = --enable-so > > [mod_wsgi] > recipe = hexagonit.recipe.cmmi > url = http://modwsgi.googlecode.com/files/mod_wsgi-3.1.tar.gz > keep-compile-dir = true > configure-options = --with-python=${directories:buildout_root}/bin/ > python --with-apxs=${directories:buildout_root}/parts/apache/bin/apxs > > > The vhosts.conf file: > > <snip> > #============================= > #Django_wsgi_app > #============================= > <VirtualHost *:8001> > > <Directory /home/toinbis/Desktop/programming/project/runtime/ > htdocs/django_wsgi/> > Order deny,allow > Allow from all > </Directory> > > WSGIDaemonProcess tsd user=www-data group=www-data threads=25 > WSGIProcessGroup tsd > > WSGIScriptAlias /djangoapp /home/toinbis/Desktop/programming/ > project/runtime/htdocs/django_wsgi/djproject.wsgi > > LogLevel warn > ErrorLog /home/toinbis/Desktop/programming/project/runtime/ > logs/apache_tsd_error.log > CustomLog /home/toinbis/Desktop/programming/project/runtime/ > logs/apache_tsd_access.log combined > > </VirtualHost> > > </snip> > > Tried adding different combinations of such lines in between > <Virtualhost> </Virtualhost>: > > WSGIPythonExecutable /home/toinbis/Desktop/programming/project/bin/ > python > WSGIPythonHome /usr/bin > #omelette dir has a symlink to all python modules installed with > zc.buildout > WSGIPythonPath /home/toinbis/Desktop/programming/project/parts/ > omelette > > But usually that just caused apache to fail during the start, > generating error(s): > > [Thu Jan 21 10:05:37 2010] [debug] mod_wsgi.c(9921): mod_wsgi > (pid=2299): Socket for 'tsd' is '/home/toinbis/Desktop/programming/ > project/parts/apache/logs/wsgi.2299.0.1.sock'. > [Thu Jan 21 10:05:37 2010] [info] mod_wsgi (pid=2433): Starting > process 'tsd' with threads=25. > [Thu Jan 21 10:05:37 2010] [info] mod_wsgi (pid=2433): Initializing > Python. > <...> - similar lines :) > [Thu Jan 21 10:05:37 2010] [info] mod_wsgi (pid=2438): Initializing > Python. > [Thu Jan 21 10:05:37 2010] [notice] Apache/2.2.14 (Unix) PHP/5.3.1 > mod_wsgi/3.1 Python/2.6.4 configured -- resuming normal operations > [Thu Jan 21 10:05:37 2010] [info] Server built: Jan 17 2010 01:54:57 > [Thu Jan 21 10:05:37 2010] [debug] prefork.c(1013): AcceptMutex: > sysvsem (default: sysvsem) > [Thu Jan 21 10:05:37 2010] [info] mod_wsgi (pid=2435): Attach > interpreter ''. > [Thu Jan 21 10:05:37 2010] [info] mod_wsgi (pid=2434): Attach > interpreter ''. > [Thu Jan 21 10:05:38 2010] [info] mod_wsgi (pid=2436): Attach > interpreter ''. > <...> - similar lines :) > [Thu Jan 21 10:11:09 2010] [info] mod_wsgi (pid=2436): Cleanup > interpreter ''. > [Thu Jan 21 10:11:09 2010] [info] mod_wsgi (pid=2434): Destroying > interpreters. > [Thu Jan 21 10:11:09 2010] [info] mod_wsgi (pid=2434): Cleanup > interpreter ''. > [Thu Jan 21 10:11:09 2010] [info] mod_wsgi (pid=2436): Terminating > Python. > [Thu Jan 21 10:11:09 2010] [info] mod_wsgi (pid=2434): Terminating > Python. > [Thu Jan 21 10:11:09 2010] [info] mod_wsgi (pid=2436): Python has > shutdown. > [Thu Jan 21 10:11:09 2010] [info] mod_wsgi (pid=2434): Python has > shutdown. > [Thu Jan 21 10:11:09 2010] [info] removed PID file /home/toinbis/ > Desktop/programming/project/parts/apache/logs/httpd.pid (pid=2299) > [Thu Jan 21 10:11:09 2010] [notice] caught SIGTERM, shutting down > [Thu Jan 21 10:24:33 2010] [debug] mod_wsgi.c(9921): mod_wsgi > (pid=3926): Socket for 'tsd' is '/home/toinbis/Desktop/programming/ > project/parts/apache/logs/wsgi.3926.0.1.sock'. > [Thu Jan 21 10:24:33 2010] [info] mod_wsgi (pid=3928): Starting > process 'tsd' with threads=25. > > > djproject.wsgi (tried removing #!/home/.../python from the begining of > the file, no help): > > #!/home/toinbis/Desktop/programming/project/bin/python > import os, sys > > apache_configuration= os.path.dirname(__file__) > sys.path.append(apache_configuration) > #django project > sys.path.append('/home/toinbis/Desktop/programming/project/src/ > tsd') > #django source > sys.path.append('/home/toinbis/Desktop/programming/project/parts/ > djangoapp/') > > > os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' > import django.core.handlers.wsgi > application = django.core.handlers.wsgi.WSGIHandler() > > > Possibly-relevant settings in httpd.conf (these are the only two > modules being loaded. Rest of the settings doesn't seem relevant to > the given problem): > > LoadModule php5_module modules/libphp5.so > LoadModule wsgi_module modules/mod_wsgi.so > > > Thanks in advance for any ideas and suggestions how to make the custom > python executable (which, itsefl, is just a wrapper script for system > python, with several added python path dirs) run the mod_wsgi app! > > -- > 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. > > > >
-- 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.
