Updated for deploying on Google App Engine.