[Grok-dev] Grok + Wsgi + Apache = Distribution not found (grokcore.startup)
Hector Blanco
white.lists at gmail.com
Fri Jul 20 15:20:52 UTC 2012
Hello everyone
I've been trying to make grok run directly with Apache and mod_wsgi,
without using Paster.
I followed the tutorial in
http://grok.zope.org/documentation/tutorial/installing-and-setting-up-grok-under-mod-wsgi/
and everything works fine in a Ubuntu 11.10 with Apache 2.2.20 (It's
even working without compiling the latest version of wgsi, but with
the one in the Ubuntu repositories, which is the 3.3-2, I believe).
Thank you very much by the tutorial, by the way. It's great.
Now, the problem comes when I try to do the same thing in a CentOS
6.3. That CentOS has a little bit older Apache version (2.2.15, which
is still using "old style" directory layouts, meaning, the
configuration is done through httpd.conf). I'm also using the system's
mod_wsgi (mod_wsgi-3.2-1.el6.x86_64) installed through yum.
When I run the grok application through Paster, everything works fine,
but when I try to start Apache, I get this in the
/var/log/httpd/error_log:
------------------------- error_log ---------------------------------
[Thu Jul 19 19:14:20 2012] [alert] (13)Permission denied: mod_wsgi
(pid=29437): Unable to change working directory to '/home/hector'.
[Thu Jul 19 19:14:20 2012] [error] [client 74.101.218.58] mod_wsgi
(pid=29437): Target WSGI script
'/usr/share/myGrokApp/server/parts/wsgi_app/wsgi' cannot be loaded as
Python module.
[Thu Jul 19 19:14:20 2012] [error] [client 74.101.218.58] mod_wsgi
(pid=29437): Exception occurred processing WSGI script
'/usr/share/myGrokApp/server/parts/wsgi_app/wsgi'.
[Thu Jul 19 19:14:20 2012] [error] [client 74.101.218.58] Traceback
(most recent call last):
[Thu Jul 19 19:14:20 2012] [error] [client 74.101.218.58] File
"/usr/share/myGrokApp/server/parts/wsgi_app/wsgi", line 137, in
<module>
[Thu Jul 19 19:14:20 2012] [error] [client 74.101.218.58]
application = loadapp("config:" + configfile, name=None)
[Thu Jul 19 19:14:20 2012] [error] [client 74.101.218.58] File
"/usr/lib/python2.6/site-packages/PasteDeploy-1.5.0-py2.6.egg/paste/deploy/loadwsgi.py",
line 247, in loadapp
[Thu Jul 19 19:14:20 2012] [error] [client 74.101.218.58] return
loadobj(APP, uri, name=name, **kw)
[ . . . ]
[Thu Jul 19 19:14:20 2012] [error] [client 74.101.218.58] File
"/usr/lib/python2.6/site-packages/distribute-0.6.27-py2.6.egg/pkg_resources.py",
line 690, in require
[Thu Jul 19 19:14:20 2012] [error] [client 74.101.218.58] needed =
self.resolve(parse_requirements(requirements))
[Thu Jul 19 19:14:20 2012] [error] [client 74.101.218.58] File
"/usr/lib/python2.6/site-packages/distribute-0.6.27-py2.6.egg/pkg_resources.py",
line 588, in resolve
[Thu Jul 19 19:14:20 2012] [error] [client 74.101.218.58] raise
DistributionNotFound(req)
[Thu Jul 19 19:14:20 2012] [error] [client 74.101.218.58]
DistributionNotFound: grokcore.startup
-------------------------------------------------------------------------
I've had errors like this when running grok through the application
regular paster, and it usually meant that there was a conflict in
Python packages, but I tried deleting every package related to this,
recreating the "grokproject myGrokApp" , rebuilding the application...
(with usr/share/myGrokApp/server/bin/buildout) and nothing.
This is the /etc/httpd/conf/httpd.conf:
-------------------- httpd.conf ----------------------------------------
LoadModule ssl_module modules/mod_ssl.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule wsgi_module modules/mod_wsgi.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule env_module modules/mod_env.so
User hector
Group hector
WSGIPythonHome /usr
WSGISocketPrefix /var/run/accessibleByHector/wsgiGrok
WSGIDaemonProcess grokProcesses user=hector group=hector threads=20
maximum-requests=10000
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, in addition to the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
#Listen 12.34.56.78:80
Listen *:80
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin at your-domain.com
#
ServerAdmin root at localhost
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If this is not set to valid DNS name for your host, server-generated
# redirections will not work. See also the UseCanonicalName directive.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
# You will have to access it by its address anyway, and this will make
# redirections work in a sensible way.
#
ServerName 192.168.1.9
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
# Defaults for virtual hosts
# Logs
#
# Virtual hosts
#
<VirtualHost *:80>
ServerName localhost
WSGIScriptAlias / /usr/share/myGrokApp/server/parts/wsgi_app/wsgi
WSGIProcessGroup grokProcesses
WSGIPassAuthorization On
SetEnv HTTP_X_VHM_HOST http://localhost/
LogLevel debug
</VirtualHost>
I've checked the wsgi script generated by the buildout
(/usr/share/myGrokApp/server/parts/wsgi_app/wsgi) and the grokcore
thing seems to be properly added to the syspath:
----------------------- wsgi --------------------------
import ConfigParser
import sys
syspaths = [
'/usr/share/myGrokApp/server/src',
'/usr/share/myGrokApp',
'/home/hector/.buildout/eggs/z3c.evalexception-2.0-py2.6.egg',
'/home/hector/.buildout/eggs/Paste-1.7.5.1-py2.6.egg',
[ . . . ]
'/home/hector/.buildout/eggs/grokcore.startup-1.2-py2.6.egg',
'/home/hector/.buildout/eggs/grokcore.chameleon-1.0.2-py2.6.egg',
'/home/hector/.buildout/eggs/zope.fanstatic-0.10-py2.6.egg',
[ . . . ]
----------------------------------------------------------
My concern is that maybe SELinux may be messing up with my life?? I
have no idea of what may be going on here.
Any idea, clue or... something will be appreciated because, at this
point, I don't know what else I can do...
Thank you in advance.
More information about the Grok-dev
mailing list