[Grok-dev] How does Grok work?

Alexandre Garel alex.garel at tarentis.com
Mon Nov 21 11:57:15 UTC 2011


Le 18/11/2011 20:24, Noe Nieto a écrit :
> Hi Cavemen.
>
> So, I've been developing for grok for some months now,  and I have 
> this question:
>
> How does grok work?
>
> I have an general idea that there is some wsgi stuff going on and 
> that's why we use paster most of the time. But I still can't grasp the 
> whole picture. When some client does a request to a grok app, what's 
> involved?
>
> For a bad example: When doing stuff with Django, you still get the 
> idea of how things are connected, but for Grok, How is wsgi and the 
> whole ZCA machinery doing it's magic?
Hello Noe,

It depends on your configuration. I assume you use paster as in 
grokproject.

To understand the link between wsgi and ZCA, you have to see :

1. paster which handles wsgi, there is a deploy.ini file which tell wsgi 
how to build the wsgi pipe (a tube of middleware like, for example, 
fanstatic, and at the end the zope application).  Each middleware and 
application in deploy.ini correspond to an entry_point in a setup.py in 
some package under [paste.app_factory] or [paste.filter_app_factory] for 
middleware. see http://pythonpaste.org/ for info about this

2.  your paster grok application is certainly the one given by 
grokcore.startup, see it in 
grokcore.startup.startup.application_factory. It just call zope.app.wsgi 
with your zope configuration (which is according to deploy.ini:zope_conf 
the zope.conf file)

3. zope.app.wsgi will setup the zodb connection, the global registry and 
much more. Then for each incoming request, this app will use 
zope.publisher to get a result.

4. so here we are down to zope.publisher, which will finally traverse 
objects, adapts to view or traverser and so one.

Hope it helps !

Alex


More information about the Grok-dev mailing list