[Grok-dev] WSGI, Repoze and deployment questions

Brandon Craig Rhodes brandon at rhodesmill.org
Wed Nov 21 14:35:29 EST 2007

Martijn Faassen <faassen at startifact.com> writes:

> All this also affects Grok's deployment story. In fact, Grok needs a
> better deployment story. I presume WSGI is going to be involved, but
> we also need documentation spelling out what to do to make Grok work
> with their favorite web server. Would Grok work with mod_wsgi?

Grok works fine if you adjust its buildout to create a "bin/wsgi.app"
command that you can point a WSGI server at.  I did it with the
attached "buildout.cfg" section, which I was planning on putting in a
little HOWTO once the new web site was up:

recipe = zc.recipe.egg:scripts
eggs = PolicyWebApp
entry-points = app.wsgi=sys:getrecursionlimit
initialization = import os, pwd
                 p = pwd.getpwuid(os.getuid())
                 os.environ['HOME'] = p.pw_dir  # for writable ~/.python-eggs
                 from zope.app import wsgi
                 from PolicyWebApp.wsgi import prepare
                 zapp = wsgi.getWSGIApplication('${buildout:directory}/etc/wsgi.conf')
                 def application(*args): return (prepare(*args), zapp(*args))[1]

Philipp will argue, quite rightly, that having a little WSGI script
inside of "buildout.cfg" is ugly.  And I will agree, but point out
that it's better than nothing until we have an actual recipe to
produce the WSGI script. :-)

I am using the above arrangement just fine with mod_wsgi, which allows
my app to run as a different user than Apache does (yay!).

Brandon Craig Rhodes   brandon at rhodesmill.org   http://rhodesmill.org/brandon

More information about the Grok-dev mailing list