[Grok-dev] Re: WSGI, Repoze and deployment questions

Tres Seaver tseaver at palladion.com
Wed Nov 21 15:56:09 EST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Martijn Faassen wrote:
> Hi there,
> 
> As a WSGI-know-nothing, I'm trying to figure out what to do to make WSGI 
> support a first class citizen in Grok.
> 
> I understand Philipp with grokproject and/or zopeproject has done some 
> work to integrate paste and WSGI.
> 
> There's also the Repoze project that offers WSGI integration, which 
> allows one to install Grok. Repoze also offers other things, of course.
> 
> What would be the way forward for Grok? What benefits and drawbacks do 
> these strategies offer? Perhaps they're mutually complementary? What do 
> we want to be possible with Grok eventually?
> 
> Perhaps we need some concrete goals. There is a cool WSGI-based Python 
> exception formatter. What would we need to do to make this available 
> with Grok?

As an example, here is what the Paste config looks after installing
repoze.grok via repozeproject::

 [DEFAULT]
 debug = True

 [filter:suppressZopeErrorHandling]
 paste.filter_app_factory = repoze.grok.bbb:SuppressZopeErrorHandling

 [app:bbb]
 paste.app_factory = repoze.grok.bbb:make_grokapp
 zope.conf = %(here)s/zope.conf

 [pipeline:main]
 pipeline = egg:Paste#cgitb
            egg:Paste#httpexceptions
            suppressZopeErrorHandling
            bbb

 [server:main]
 use = egg:repoze.grok#zserver
 host = 127.0.0.1
 port = 8080

That version uses the "colorized traceback" handler, supplied by the
'Paste#cgitb' entry point.  There is also the "evaluate expressions
against the traceback frames" version (waaaay nice, but leaks *every*
request / framestack which has an exception, so obviously only useful
for debugging), for which the pipeline section would look like::

 [pipeline:main]
 pipeline = egg:Paste#evalerror
            egg:Paste#httpexceptions
            suppressZopeErrorHandling
            bbb

> 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?

It already does, under Repoze.  See

 - http://grok.repoze.org/animals

 - http://grok.repoze.org/bookshelf

 - http://grok.repoze.org/todolist

The relevant Apache config is::

 WSGIDaemonProcess grok threads=1 processes=4 maximum-requests=10000 \
    user=tseaver \
python-path=/home/repoze/www/grok.repoze.org/lib/python2.4/site-packages

 <Directory /home/repoze/www/grok.repoze.org/bin>
   Order deny,allow
   Allow from all
 </Directory>

 <VirtualHost *:80>
   ServerName grok.repoze.org
   ServerAdmin repoze-dev at repoze.org

   WSGIScriptAlias / /home/repoze/www/grok.repoze.org/bin/grok.wsgi
   WSGIProcessGroup grok
   WSGIPassAuthorization On
   ErrorLog    /var/log/apache2/grok.repoze.org-error.log
   CustomLog   /var/log/apache2/grok.repoze.org-access.log combined

 </VirtualHost>

which points to the following "loader" script (grok.wsgi)::

 import os
 from paste.deploy import loadapp

 instance = os.path.join(os.path.abspath(os.path.dirname(__file__)),
                         '..')
 os.environ['PYTHON_EGG_CACHE'] = os.path.join(instance, 'egg_cache')
 ini = os.path.join(instance, 'etc', 'grok.ini')

 application = loadapp('config:%s' % ini)


I will note that the generated version of grok.wsgi is broken in the
current release of repoze.grok:  I had to fix it manually.


Tres.
- --
===================================================================
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHRJtp+gerLs4ltQ4RAp3ZAJ9vLVRSy2FCsJd4CiZxlG532ESnGgCePvdL
EFK44+TCEJQNmP3DpimwOww=
=RA8V
-----END PGP SIGNATURE-----



More information about the Grok-dev mailing list