martynj.com - things I have learnt

How to Host a Simple Web Site for Free with Google App Engine

...in 9 moderately involved steps.

A Guide I wrote for my Dad.

Google App Engine is a free (up to 5 million pageviews per month) web application hosting platform that provides an interface to Google's highly scalable infrastructure. It's a very powerful platform, not really targeted at simple static HTML websites, but with a bit of setup effort, it can provide a great way to host your website for free.

The following instructions assume that your website is static HTML (no serverside logic) and you're using Windows on your local machine (though the same software is also available for Mac and Linux). I opted for the Python flavour of App Engine, though Java is an option too.

1. Login into https://appengine.google.com/ with your Google account. (No Google account? Get one at https://www.google.com/accounts/NewAccount)Create an Application for your website; the identifier you choose here won't be publicly visible except as part of the temporary domain name before DNS setup, but will be used in your code.

2. Download and install Python 2.5.4 for Windows (2.6 is a bit flaky with App Engine as of Dec 2009) and the AppEngine Software Development Kit (SDK).

The full App Engine docs are at code.google.com/appengine, but for a static site, there's just a few steps to follow.

3. Create a subdirectory of your Appengine install directory with the name of your application and create a file called app.yaml (YAML = Yet Another Markup Language).

4. app.yaml instructs the Appengine runtime what to do with incoming requests. We want all requests to hit the local HTML file with the name specified in the URL, except for the the special case of http://www.yourdomainname.com/ where we want it to load index.htm (or whatever the homepage is called), so there's two mappings as below.

application: application_name_here
version: 1
runtime: python
api_version: 1

handlers:
- url: /
  static_files: html/index.htm
  upload: html/index.htm
- url: /
  static_dir: html/

5. Drop your HTML files and image folders etc into a subdirectory of your application named html.

6. Test the site by running the development appserver that's bundled with the Appengine SDK with the following command at the Windows Command prompt (Start > Run > cmd [enter]):
dev_appserver.py application_name_here

7. Once the dev_appserver is running, open http://localhost:8080/ in your browser and check everything on the site works.

8. To upload the site to AppEngine, run appconfig.py with the update option.
appcfg.py update application_name_here
This will prompt you for your Google account credentials then upload all the files to appengine. Once done, your site will be visible at http://application_name_here.appspot.com

9. Once you've checked the upload worked, you can setup the DNS for your domain name. This needs to be done by registering the domain name with Google Apps http://www.google.com/a/cpanel/domain/new and configuring your DNS as instructed.

Tagged: google tech software

blog comments powered by Disqus