meetteem: tech addict

software development, etc.

Viewing posts tagged 'appengine'

File Tambayan: My Storage in GAE

Beer caused this.

I had some bottles of beer last night. I definitely felt the alcohol circulating in my brain. I tried to stay awake but at around 12 midnight, I fell asleep. I woke up at 4 in the morning when my roommate turned the light off and having remembered that I forgot to send an sms to my dear ahem, I turned back the light on and searched for my phone. I found it on the floor, on top of my left rubber shoe. I was more awake now than when I had stood up from my bed. I got my MacBook and I remembered I was checking out my S3 account information right before I fell asleep. Four cents. Less than 20 pesos. Still, it's money I'm gonna have to pay everytime someone downloads a file from my S3 account. So I set myself a deadline: 10 A.M. By 10 in the morning, around 6 hours from that time, I must deploy a personal online storage app in Google App Engine.

So here it is. The beer's effect. My File Tambayan. I described it in teemlabs as

A simple file storage app ala s3. It's minimal (no thumbnail processing, has no css, etc), just plain file uploading and downloading.

It resides in teemlabs. It is written in Python, with the Django framework. Writing it as a small Django app will make it easier to install in other appengine applications. Somekinda drop-and-load of the module. Easy. Well, I think it's easy.

Here's the link to the first file uploaded to the Tambayan: rspec-1.1.3-tmBundle_patch.diff

I want to open its source, but only if there is interest in it. Like if you want to learn a little bit of Google App Engine, or just want to have an online storage, just like me. Having coded this so early in the morning, and being the n00b that I am, I'm not sure if you'd want to take a look at its source. Just send me an email if you want to look at the code, or just roll out your own.

w00t! desyd is Up

Yup! I've just deployed my first Google App Engine app. Dubbed desyd, this app can be used to tabulate the pros and cons of anything. You can share the pros and cons of making a specific decision to the world. You can quantify each pro and con to help you decide much better.

If I can spare some more time, I plan to make it Ajaxxy. And I hope to add some stuff like commenting, and even adding notes to a pro or con.

It's simple really, and I wonder if it's going to useful. So, why don't you go ahead and try it, then tell me what you think?

This release in the pre-alpha stage. Haha! So, I'd really appreciate comments and stuff. :D

Putting teemlabs Under Git

Yesterday, I blogged about my adventure with Google App Engine and the 'launch' of teemlabs.

I knew that I had to maintain the source code of this app, and that meant creating a Git repository. The thing was, I didn't know, and still don't, if the .git directory will be uploaded to the Google servers when I deploy the application. (I have an update at the end of this post regarding this.) I don't want that. I thought of putting the main application directory inside another directory which would contain the .git directory, making the parent directory the root of the Git repository.

|--teemlabs.git
   |--.git
   |--teemlabs       <-- the app

I thought I knew what to do, but I encountered a problem creating the git repository.

Here's what happened.

~/dev/projects/appengine/teemlabs$ git init
Initialized empty Git repository in .git/
~/dev/projects/appengine/teemlabs$ mate .gitignore
~/dev/projects/appengine/teemlabs$ gst
# On branch master
#
# Initial commit
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       .gitignore
#       teemlabs/
nothing added to commit but untracked files present (use "git add" to track)
~/dev/projects/appengine/teemlabs$ git add .
~/dev/projects/appengine/teemlabs$ git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
#       new file: .gitignore
#       new file: teemlabs
#
~/dev/projects/appengine/teemlabs$ git commit -m "Initial commit."
Created initial commit 25936f1: Initial commit.
 2 files changed, 3 insertions(+), 0 deletions(-)
 create mode 100644 .gitignore
 create mode 160000 teemlabs
~/dev/projects/appengine/teemlabs$

I then copied teemlabs to my slice, and git cloned the new repository. Yup, it was cloned... except that the files under teemlabs/teemlabs weren't there.

Why? Didn't git add . add the teemlabs directory? Well, yes. It did add the teemlabs directory-- but only the directory. The files inside weren't added.

So I added them.

~/dev/projects/appengine/teemlabs$ git add teemlabs/*
~/dev/projects/appengine/teemlabs$ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       deleted:    teemlabs
#       new file:   teemlabs/app.yaml
#       new file:   teemlabs/templates/index.html
...
~/dev/projects/appengine/teemlabs$ git commit -m "Add the teemlabs files."
Created commit 3c493b6: Add the teemlabs files.
 14 files changed, 177 insertions(+), 1 deletions(-)
 delete mode 160000 teemlabs
 create mode 100644 teemlabs/app.yaml
 create mode 100644 teemlabs/index.yaml
 ...

Now, all is well and good. Cloning the repo included the files.

But it took two commits just to add a single directory. This shouldn't be the case. Adding a new directory and the files it contains can simply be done with the following steps.

git add directory
git add directory/*
git commit

I'm confused, though, why sometimes just a simple git add . and git commit works, but this time, it doesn't.

Oh, well.

Update:

After reading more of the docs, I found out that app.yaml has a skip_files element which allows you to skip uploading of files. And Unix hidden files are, by default, not uploaded. I didn't have to create a parent directory, which acts as the root of the git repo, for teemlabs. I could simply run git init in the teemlabs directory itself.

24 Hours with Google App Engine

In the past 24 hours, I looked at Google App Engine. The result: the index page of teemlabs.

Yes, it's a static page. But that's not the point. The point is, I'm now more familiar with appengine than I was yesterday, and I'm lovin' it.

Just a run-down of the things I did regarding appengine yesterday.

I downloaded and installed the new Google App Engine Launcher. It's for Apple machines only.

This app is sweet. You want to create new app or deploy your freshly coded app? Or maybe you just wanna view logs? One click is all it will take. Or something like that. :P I also set TextMate as the default editor, and enable the option to open the directory.

I made a widget creation app, whatever you call that thing in iframes or javascript that you embed in your blog or web site. But I chose not to deploy it for personal reasons.

I decided to work on that app using Django. I read this and applied what I read to my code.

I also learned a little about the Datastore API, which allows your app, well, to store data. Django ORM, while I think is really, really nice, isn't supported by Google App Engine. Datastore API is similar to Django models API, so it wasn't much of a hassle. Then, there's the Query class, which has the filter() and order(). Still familiar. And then the GqlQuery class! It's a query interface which uses GQL, an SQL-like query language. Quite familiar but I prefer the less SQL-like Query class to this one.

One thing I failed to try was the validation of attributes of a Datastore object. I think validation is fairly easy to do, as the docs say, the validator is just a Python function, though I have to see this for myself.

I had to look at the Django 0.96 documentation once in a while. My Django's a little bit rusty.

I also downloaded and installed python-dateutil to the app. I had to manually add the directory of the python-dateutil to the Python path before I could import it.

And then teemlabs! I wanted to deploy an app before the day ends. A little bit of CSS here, some Django templates there, I was ready to deploy teemlabs! A single click, Click! Uploading... Failed. Oh! A typo in the app.yaml. app.yaml is used in deploying your app. I mistyped the application to 'teemlab' instead of 'teamlabs'. Tsk.

So there. I don't think I mentioned everything appengine-related I did in the last 24 hours. Oh wait, I also joined the Google App Engine Google Group.

Although some people have blogged about some limitations of appengine, I'm even more excited about appengine, after I've read the docs and all.

Earlier today, Google added two features to appengine: the Images API and the Memcache API. They've updated the SDKs. It was version 1.0.2 yesterday; now, it's version 1.1.0. Sweet.

Good things get even better.