More than a year ago I wrote a “buzzword bingo” application. I was at work and had about three hours to kill while waiting for some scripts to finish, so I hacked together some PHP to pick random words out of a file and put them on a bingo card image that I found on Google image search.
This made conference calls more interesting and probably caused my friends at work to listen more closely than they would have otherwise. It was fun for a while, and then we kind of forgot about it.
The last time I thought about it before this week was when I got a nasty email from someone in Canada complaining that there were 500 bingo cards printed out on their printer in color. Since I hosted this app out of my home directory, my LDAP name was in the URL for every page. I explained that anyone with a browser could have printed it out, which got no response. (I sure hope he doesn’t have a job that requires deduction.)
But anyway, I have been trying to stay abreast of Google’s 6,000 APIs, and App Engine seemed as good a place to start. (I played with Open Social a little the week before.) Porting my simple bingo card app to Python and to Google App Engine seemed like the perfect starter project.
I worked through the tutorial using vim, then I tried to work through it again using Eclipse. Maybe I’m just an idiot, but after using Eclipse for over two years I still don’t really get it. I can run programs and include libraries and set breakpoints for debugging, but I get the impression that somehow I’m doing it all wrong. After a few hours trying to find a browser previewer to show the app dev server, I gave up on Eclipse in search of a new IDE to work with.
And after reading through this thread about Python editors, I downloaded the free (as in speech) Komodo Edit app. I spent most of last night using it to port my bingo card app, and I think it’s a great development environment for App Engine.
I’ve only used Komodo Edit for a little while, but here are the steps I took on my government^WGoogle-issued MacBook Pro (running Leopard) to get it set up for App Engine:
1. Download Google App Engine SDK and install
2. Download Komodo Edit and install. (I installed 4.3.2 for x386.)
3. Configure Komodo Edit
a. Make a command to start the dev server
Tools->Run Command…
In the Command box: /usr/local/bin/dev_appserver.py %p
Check Add To Toolbox
Press the More button
Select Run In New Console (otherwise you won’t be able to run any other commands)
b. Make a command to upload the app to Google
Tools->Run Command…
In the Command box: /usr/local/bin/appcfg.py update .
Check Add To Toolbox
Press the More button
In the Start in box: %p
Select Run In New Console
Note that these commands will show up when you show the Toolbox, which you can see by toggling the “Show/Hide Right Pane” or selecting View->Tabs->Toolbox from the main menu.
c. Add the Google libraries to the code completion path
Go to Komodo->Preferences…
Languages->Python
Add /usr/local/google_appengine
d. Django file extension
This isn’t really a configuration, but remember to save your Django templates (the templating language that Google App Engine uses) with the file extension .django.html to enable syntax highlighting.
e. Add handy URLs
I found it handy to add some common URLs that I was using in development.
To add a URL go to the main menu and select Toolbox->Add->New Url…
I added these:
Appspot login == http://www.appspot.com/
Google App Engine intro == http://code.google.com/appengine/docs/gettingstarted/introduction.html
http://localhost:8080/ == http://localhost:8080/
Double click to launch the default browser, right click and select Open URL in Tab to open it as a tab in Komodo Edit.
f. Use vi mode if it floats your boat
One interesting feature is the ability to use vi or emacs commands in the editor window. You can set this in the Preferences under Edit->Key Bindings, then select Vi under Key Binding Schemes. I turned this on for a while but quickly tired of the novelty.
There is also an emacs mode, but it seems unnecessary because if you know emacs you are already such an efficient programmer that using a program with a gui Komodo Edit would be too jolting, sort of like a speeding race car hitting a large pothole.
g. Getting a side by side view
I heard this complaint in a review of Komodo Edit, so here’s how I was able to do it (not that I really used this):
Put focus on a file you are editing
Window->Move To Other Tab Group
Window->Rotate Tab Group
4. Create a project
I didn’t really get the whole Live Import thing, so I might be doing this wrong. I made a directory, copied the .yaml, .py, and .html files into it, then File->New->New Project… Then I browsed to the directory and saved the project file with the name of the app that I was working on. Be careful naming the project because I couldn’t figure out how to rename project files.
When uploading the app to Google only the necessary files are uploaded, so it doesn’t matter if the project file is in that directory or not.
I’m not sure how the project view (on the left hand side) maps to the file system. I created a directory and moved a file into it from the project view, but that wasn’t reflected in the file system. So I just moved files around with Finder and then selected File->Refresh Status from the main menu.
5. Reflect on the experience
Once I was set up it was very easy to code, test, and deploy with this environment. You can check out the end result at http://wordbingo.appspot.com/ After I password protect editing the buzzwords, I’d like to try to make it multiplayer. But that might require more free time than I have.
(Actually, if I had some extra time I’d really like to set up syntax highlighting and code completion for the Gadget API — because I spend a lot of time on gadgets, gadget ads, and Open Social gadgets. Currently I’m using the Google Gadget editors which are okay but have their limitations.)
Now you have a full accounting of last Friday night between the time that my wife fell sleep putting my son to bed at 8:00 and when I went to bed at 12:30am.
8 responses so far ↓
1 A pseudo IDE for Google App Engine - Komodo Edit « AB’s reflections // Apr 21, 2008 at 8:22 pm
[...] Just noticed that another person has posted instructions for using Komodo Edit as an IDE for Google App Engine (on Linux it seems), including steps for setting up the uploader among others. [...]
2 Shane Caraveo // Apr 21, 2008 at 9:53 pm
Hi, just to let you know, there is an OpenSocial extension (includes some gadget support) in our addons section at http://community.activestate.com/komodo-extension/opensocial
3 Alberto // Apr 22, 2008 at 12:53 pm
Very useful. Thanks!
4 Herve // Apr 29, 2008 at 5:19 am
Very Cool!
I can now start the server.
But how can you stop it ?
5 David // May 31, 2008 at 2:51 pm
Thanks so much for this!
note:
b. Make a command to upload the app to Google
In the Start in box: %p didnt seem to work for me, but appcfg.py update %p worked like a dream
6 steve // Jun 2, 2008 at 11:34 am
thanks so much for the tips!
7 kvieserc // Jun 10, 2008 at 1:48 pm
just thank you very much
8 Robert // Jul 3, 2008 at 11:53 pm
Thanks for the tips. I am new to Python, GAE, and Komodo. While I got the commands running with little problem I am still fuzzy on how to debug (e.g. set a breakpoint). How do I run dev_appserver.py “under” the debugger so my breakpoints actually trigger?
Thanks,
Robert
Leave a Comment