Saturday, June 6, 2009

Host your homepage at Google

Google does not have a free web-hosting service. Once upon a time there was a Google Pages, but that is now replaced by Google Sites. Pages allowed quite good control over the HTML that it generated, but its upload/download capabilities was not that good. Now Sites does not even allow control over HTML, because the structure of the pages are pretty strict. I can forgive it, since Sites is actually a very good collaborative tool.

I had an iWeb-created homepage on, and I pretty much liked that, but I'll remove my hosted server from the provider, so I had to find a place for this page. No PHP, no database, no code, just the HTML generated by iWeb.

I did not need too big space, but I wanted some reliability, so I choose Google.

But how do you host your page at Google if it does not have a web-hosting service? The answer is: Appengine! It can serve static files, and can store files up to 100MB (I think). Though it is not really designed for that, but it works. It is also not designed for frequent webpage updates, but I also did not need that.

How do you do that? Here are the steps:

1, Create an account at Google. Pretty easy from the Appengine homepage.

2, Create an application. It is also straightforward from the same page. You don't need to set up any authentication, just select a nice name for that, like www-example-com.

3, Download the AppEngine SDK. This is the official location of the SDK. Install it also.

4, Create your web-application. This is the hardest part, but it is not that hard either:

Create a directory for your application, let's call it myapp.

Copy your webpage into that in the data subdirectory.

Create an app.yaml file for the application. It is almost just a copy-paste from here. The only thing you need to edit is your application name:

application: myapp
version: 1
runtime: python
api_version: 1

- url: /$
static_files: data/index.html
upload: data/index.html

- url: /(.*)$
static_files: data/\1
upload: data/.*

4, When you are ready, you can upload your application (assuming you are in the myapp directory): update .

That's so simple. At least it seems. There are some problems with this simple approach, but you probably won't run into that:
  • I had filenames in my blog, which contain dots, and appengine did not like them.
  • Another issue is that in case the URL has // (double slash), then it reports a 404. Some of my internal links created URLs like that, so it had to be worked around that also.
If you are interested, I can explain how you can work these limitations around, let me know if you are interested.

No comments:

Post a Comment