Wednesday, March 25, 2009

Getting started with google app engine

Its pretty straight forward to create an application on Google App Engine. I am briefly listing the steps involved in creating and deploying applications along with some mistakes that one could potentially make.

1. After you download the SDK (I used a Mac), start the GoogleAppEngine Launcher. This opens up a nice UI which I henceforth refer to as 'Launcher UI'
NOTE: When the launcher comes up, allow it to create symlinks. Basically this creates links for some very useful scripts (like , etc) in /usr/local/bin. This is very important if you plan to use the or the scripts from command line instead of using the Launcher UI. if you do not create the symlinks, when you run the script using the full path to it, the script may terminate with errors like "......ImportError: import google not found....."

Launcher UI

2. Log in to the google app engine website and register an application.

3. Follow the steps 'Creating Simple Request Handler' and 'Creating the Configuration File' listed here.
NOTE: the 'application' label in app.xml should be same as the Application Identifier you use when you create an application. If they are not, when you deploy the application on the app engine you will get errors like: An unexpected error occurred. Aborting.
Traceback (most recent call last):
File "/Users/annika/Desktop/", line 1213, in DoUpload...........
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)HTTPError: HTTP Error 403: Forbidden

4. Test the application using the script as listed in the above website under the section 'Testing the application' or you can use the Launcher UI. In the Launcher UI, use the File -> 'Add Existing Application' since you have already created the application in step 3. Clicking the run button will run it on the default app server on your local host. Clicking the browse button will launch the browser and you can view your application on your local host. Clicking the stop button will stop the app server.
NOTE: In the launcher UI if you choose File -> 'New Application', and provide it the directory of your existing application, it will create a brand new application directory within your existing application directory. It will automatically create default app.yaml and .py file in the new directory. This will be the application that will be deployed and not your existing application.

5. Upload the application using the script as listed here or click the deploy button on the launcher UI.

6. You can modify the application by editing the .py file and can give it a different version in app.yaml file. Then you can redeploy the app using step 5.
NOTE:If the version in app.yaml is different from the original version(which is considered default), and you wish to make the newly uploaded file the default version for your application, go to your application dashboard in the app engine website, click on versions and make the newly uploaded file your default version, otherwise you will not see the changes. Remember only the default version shows up as the application in the website.

No comments:

Post a Comment