[Grok-dev] Re: Grok in single threaded mode

Philipp von Weitershausen philipp at weitershausen.de
Tue Aug 21 12:23:06 EDT 2007


Sebastian Ware wrote:
> Thanks for the info! Is it a simple configuration to get Zope to run 
> with ZServer instead of Twisted?

When using Paste, it's dead-simple:

Simply start out using my branch of grokproject that is based on 
zopeproject:

   $ svn co 
svn://svn.zope.org/repos/main/grokproject/branches/use-zopeproject/
   $ cd use-zopeproject

To get it running, run the buildout:

   $ .../path/to/some/buildout bootstrap
   $ bin/buildout

Now, create a new project:

   $ bin/grokproject Sample
   ...
   $ cd Sample

Now we actually have a grok application based on Paste. It pretty much 
looks like any other grok application, except that it has an 
src/sample/application.py module which defines the application startup, 
and it has site.zcml, zope.conf and deploy.ini in the project directory 
(which are not auto-generated by buildout.cfg).

We edit deploy.ini. The default HTTP server that's preconfigured is 
Paste#http. It also supports a single-threaded mode by adding the 
following options to the [server:main] section::

   use_threadpool = True
   threadpool_workers = 1
   threadpool_spawn_if_under = 1

To switch to zope.server (the term "ZServer" doesn't really apply here 
because it's the one from Zope 2, zope.server is a complete rewrite) in 
single-threaded mode, change the [server:main] section to::

   [server:main]
   use = egg:zope.server
   host = 127.0.0.1
   port = 8080
   threads = 1

To make sure that the right zope.server egg is enabled, also edit 
buildout.cfg and make sure that the [app] section also loads the 
zope.server egg in an appropriate version::

   [app]
   recipe = zc.recipe.egg
   eggs = Sample
          Paste
          PasteScript
          PasteDeploy
          zope.server>=3.5.0a1


-- 
http://worldcookery.com -- Professional Zope documentation and training


More information about the Grok-dev mailing list