Personal tools
You are here: Home Documentation Tutorials Adder: an adding machine sample application Installing a Grok Application

Installing a Grok Application

Learn how to install an existing Grok application, and
The most basic Grok app that is still of some use: an adding machine with tape.
Page 1 of 4.
Might be outdated! This document hasn't been reviewed for Grok 1.0 and may be outdated. If you would like to review the document, please read this post.

This is the simplest Grok application that is of still some use, it is a simple adding machine that keeps track of previous totals.

Installation

If you want to checkout the source code and run the application locally you can fetch it using subversion:

svn co svn://svn.zope.org/repos/main/grokapps/Adder Adder

This application comes with two files, a simple bootstrap.py that will install a 'buildout' binary into your project and a buildout.cfg that describes the configuration of your Grok project. The only thing to note at the moment is that this buildout.cfg sets a username and password of 'grok' and 'grok' with Site Manager access. You can install the application with the following commands:

$ cd Adder
$ python bootstrap.py
$ ./bin/buildout
NOTE::
copy versions.cfg from a newly created project (e.g. Sample) issue on MS Windows?

You'll get lots of output at this point and it will take some time to download and install of the necessary software. Later on you may wish to configure your own buildout defaults so that most parts are installed into a shared location and you can then buildout new applications very quickly.

You should now be able to start up an HTTP server to run your application. We'll can attach this process to the controlling terminal using the 'fg' (foreground) command. This way we can easily stop the server by pressing Ctrl-C, and any error messages will be sent to the terminal, making it easier to debug:

$ ./bin/zopectl fg

You should see text similar to the following, letting you know that the server is ready and listening on port 8080:

------
2008-01-06T16:35:02 INFO root -- HTTP:localhost:8080 Server started.
    Hostname: localhost
    Port: 8080
------
2008-01-06T16:35:02 INFO root Startup time: 2.760 sec real, 2.720 sec CPU

You can now point your web browser to http://localhost:8080/ and you will see the Grok Administration Interface. You can see that you currently have no installated applications, but you do have an application at adder.app.Adder available for installation. Create an instance of this application and name it adder, now you will see this show up in the installed applications section and this instance is available at the URL:

http://localhost:8080/adder/

When you install an application it will create the necessary bare-bones data required to run the application in your database. This application uses the ZODB, which is embedded as part of your application, and will store the data in a file at parts/data/Data.fs.

Installed Files

The layout for the installed files for the Adder application should look like this:

./installed-adder.png

The files in grey are stored in a source code management system such as subversion. The files in orange are downloaded from the internet when you run the ./bin/buildout command. In the screenshot above, the eggs directory is not present as this was installed elsewhere into a shared location. The bootstrap.py file is in red since this file is a required prerequisite to create ./bin/buildout that not all Grok applications may include a copy of it on the assumption that you already have a copy of this file on your system.