Using buildout with appengine
21 Sep 2009 von Bernd Dorn, gepostet in cloud, Python und Web (2.0)
At Lovely Systems we use
zc.buildout to configure our appengine projects. With this post we'd like to introduce one method where buildout could be used for an appengine application that depends on 3rd party modules. In this example the
tornado modules are used for views and
zope.testing and
webtest for testing.
The example application is part of the
lovely-gae package. The source can be browsed
here and the running application is available at
http://lovely-gae.appspot.com/ (there is not much to see).
To run the app you just have to export/checkout the example app directory.
svn export https://lovely-gae.googlecode.com/svn/trunk/example
Then replace the application id with your application id in
app/app.yaml
Now run the bootstrap script, which downloads setuptools and buildout, and creates the buildout commandline tool in bin/buildout.
python bootstrap.py
Now you have to run the actual buildout.
./bin/buildout
This creates a ./bin/instance executable that starts the development server. Note that the dev_appserver.py script from the appengine SDK has to be on the path in order for this to work.
Now to start the development server run
./bin/instance
and go to http://localhost:8080 with your browser to view the start page.
Take a look at the following files, which are all documented inline:
buildout.cfg
app/app.yaml
app/environment.py
app/main.py
app/tests.py
Tests can be run by using the generated ./bin/test executable. Run it with the --help option to get more information.
Caveats
Currently the egg directory is not cleaned up when a newer version of an egg is available, so the app/packages directory needs to be deleted and the bootstrap buildout process has to be re-run, so that the old packages are not in the python path anymore.