Ian Bicking: the old part of his blog

TracPaste & CherryPaste

As a kind of first-experiment both in appropriating another package and in poking Paste (and setuptools) conventions into a package, I have Trac now working with Paste, both the WSGI side (using their WSGI branch) and the installation. It works like this:

easy_install 'PasteScript[Cheetah]==dev' 'PasteDeploy==dev' 'Paste>=0.4.1'
paster make-config TracPaste mypackage
# You can edit mypackage/conf/trac.ini now
paster setup-app mypackage/conf/trac.ini
paster serve mypackage/conf/trac.ini

And that's all you need to setup a project. Now, you might say that this is not really much easier than Trac is normally. Except, of course, you now can run it with Paste. You are probably not impressed.

But it does use a clever easy_install hack. TracPaste is in the Cheese Shop, but has no packages yet -- purely svn. The WSGI branch of Trac isn't in the Cheese Shop, but I can link to it from the TracPaste page, and get easy_install to automatically install it by using the requirement Trac==wsgi,==1.0dev -- the branch itself is labelled 1.0dev, but I put a link to the branch with #egg=Trac-wsgi appended. You have to give both versions because easy_install will download based on that link (guessing that ==wsgi will match), but the result installation does not satisfy the ==wsgi requirement since it is marked upstream as 1.0dev.

Paste Script also uses two-phase install. trac-admin uses an interactive installation, where it asks you questions. I find this very annoying, because I don't know what questions are coming up, and I don't know the answers without doing ^Z a bunch of times. This version installs the config file, but doesn't set anything up until you call setup-app (which writes the database and some files). The config file is still just a randomly-ordered set of sections (blame ConfigParser), but in a better setup it would be a nice config file with helpful comments and with commonly-changed things at the top.

In related news, here's a quick setup for a Catwalk SQLObject model browser:

easy_install http://svn.cherrypy.org/trunk/
easy_install -f http://turbogears.org/download/ TurboGears==dev CherryPaste

I don't have a make-config setup for it, and I'm not sure I'll make one. You just make your own config like:

use = egg:CherryPaste#catwalk
model = mypackage.mymodel
# If you need to configure a db connection:
database = mysql://...

use = egg:Paste#http
host =
port = 8080

Then do paster serve catwalk.ini and you'll be set. Now you don't have to be using TurboGears to use Catwalk -- you can even embed Catwalk into your own (WSGI/Paste) application with relative ease, because that configuration file just maps (exactly) to this Python:

# egg:CherryPaste#catwalk is defined as this import in
# CherryPaste/setup.py:
from cherrypaste.tg import make_catwalk
app = make_catwalk({}, model='mypackage.mymodel',

Being able to do exactly this was actually one of my primary motivations for CherryPaste.

Created 19 Jan '06


The ability to be able to use Catwalk inside any WSGI/Paste application should give a practical example to those who at times have wondered why you keep "pushing" the WSGI stack solution. Hopefully more developers will consider making their web components WSGI and Paste deployable. So glad I use WSGI/Paste/SQLObject in my latest web projects, Catwalk will make development even more "cool".

And were do you find the time to do all this excellent stuff? or is Ian Bicking really a team of python bots :-). Keep up the excellent work.

# Mark Rees

You need to specify a development version of SQLObject in your easy_install line too, or it barfs on wsgi_middleware.

# Nicholas Riley