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.