Thursday, August 27, 2009

GI/GAE Deployment

I recently had a breakthrough in which I got a General Interface client to communicate successfully with a Google App Engine back-end via JSON. Not only was that success using Google's development server running on locally, but it was with the GI client running inside of the GI builder tool. My success tonight was getting the GI application successfully deployed on the GAE development server. Now I can run the application by navigating to a URL. This involved three main steps: tweaking GAE to support static files, copying the right GI files into the right GAE folders, and creating a GI launch page for my application.

Activating support for static files on GAE is fairly well documented. In my case, I decided to add a "static" folder under my GAE application folder ("winenotes"). I then modified my app.yaml file to look like this:

application: winenotes
version: 1
runtime: python
api_version: 1

handlers:
- url: /static
static_dir: static

- url: .*
script: winenotes.py

In this way, static files can be accessed by tacking their path and file name to the end of the URL, starting with the "static" directory.

The second piece is copying the GI files to the GAE server. I created a "gi" directory under "static", and copied both the JSX and JSXAPPS folders there (I removed everything from JSXAPPS except the folder for my application).

The final step is creating a launch page, as described in the GI Developer's Guide. From within the builder, I selected Project > Deployment Utility. I picked the "static" directory and named the file "launch.html". Clicking Create automatically generates a starter file with the specified name and location. The paths in the generated file required a bit of editing; I modified the script section to look like this:

<script type="text/javascript" src="gi/JSX/js/JSX30.js" jsxapppath="gi/JSXAPPS/wineLog/">
</script>

That's it. Once I started the Google App Engine server, I was able to launch my application by opening http://localhost:8080/static/launch.html. The only glitch is an error message that appears as the application is loading:


The application seems to load just fine after clicking OK. I need to investigate the error message further.

No comments: