Quickstart with Grok


In this quickstart, we will use zc.async to make a small web application that is a Python Package Index (PyPI, http://pypi.python.org/) helper portal. We’ll call it “My PyPI,” to be cute.

My PyPI will let you subscribe to changes of specific packages, rather than the entire package index; and will let you associate external web pages with packages for you and others to see and search on.

We’ll make a number of “toy app” decisions to keep the story quick, but it should be a good example for how to leverage zc.async.

Also for simplicity, we’ll assume that we are making several instances on the same machine, such as you might do with a few processors at your disposal. To get the true advantage of high availability in production, you’d want at least two boxes, with a deployment of a ZEO server (or equivalent, for RelStorage), some kind of redundancy for your database (ZRS, or slony for RelStorage plus PostgreSQL) and instructions for each box on how to connect to the ZEO primary.

This quickstart is more complex than the Quickstart with virtualenv. I suggest you read that through before this one.

  • That previous quickstart introduces zc.async through the Python interpreter for a very casual and quick start.
  • It also is more “pure-Python” with very little understanding needed of additional frameworks to follow and use the examples.

This quickstart instead uses the following somewhat “heavier” technologies.

  • zc.buildout is a way of producing repeatable software build-outs, for development and conceivably for deployment. It is written in Python, but is not Python-specific, and it has found use as a make replacement for many projects.

  • Grok is a web framework emerging from “Zope 3” technologies. From their website:

    Grok is a web application framework for Python developers. It is aimed at both beginners and very experienced web developers. Grok has an emphasis on agile development. Grok is easy and powerful.

This guide, then, takes a somewhat slower definition of “quick” for its “quickstart”, in exchange for more guidance and care with a view towards production-readiness.


As of this writing, Grok requires Python 2.4. Moreover, for more repeatable installations, many developers strongly recommend using a “clean”, non-system Python, to reduce the probability of unnecessary or spurious problems (in your software or in your system!). Therefore, consider building your own Python 2.4 for your development.

We’ll also expect that your Python has easy_install. If it doesn’t, you can just download ez_setup.py and then run it with your local, development Python (e.g., ~/opt/py/bin/python ez_setup.py). This will install the easy_install command for your development Python in the same bin directory as your Python (e.g., ~/opt/py/bin/easy_install).


Grok has a pleasantly convenient way to start a project. It is called grokproject. Use your local Python’s easy_install to install it. For instance, I might type ~/opt/py/bin/easy_install grokproject.

After it runs, it should have installed the grokproject command in the same bin directory as your local Python (e.g., ~/opt/py/bin/grokproject).


Now we will use grokproject to make a skeleton of our package. Let’s call the project “mypypi”. Go to a directory in which you want to develop our package. Then use the newly installed grokproject command to create


  • include zc.async in setup.py; mention versions.cfg
  • set up ZEO
  • set up multiple instances
  • zope.app.testing = 3.4.1 -> 3.4.2
  • set up interpreter
  • set up z3monitor
  • make separate debug instance

Table Of Contents

Previous topic

Quickstart with virtualenv

Next topic


This Page

Quick search