Tuesday, December 29, 2015

Published my first Google App Engine Python Application


This would have been a post if everything went easily. But it was not easy. Got one trouble. Ok let me start the story.

Introduction

Google App Engine (here after GAE) was there for long time at least from 2011 its no more preview. Unfortunately I didn't get a chance to play with it. Now since my family went to India during the winter season, I have enough time to play around.

I never thought it would be easy as publishing web site from Visual Studio to Azure in single click. But app engine is simple as one click publish.

First I ensured that it still has free quota. Because being in the Microsoft shop in my day job who embraces Azure a lot, there is no way I will be hosting an application into Google cloud. So its for my personal use and for personal use I never wanted to pay money. Oh except my domain and hosting space.
https://cloud.google.com/appengine/docs/quotas

First Python application targeting Google App Engine

Then I started with the below basics on Python based GAE development and how to publish a simple Python web app into GAE.
https://cloud.google.com/appengine/docs/python/
https://cloud.google.com/appengine/docs/python/tools/devserver
https://cloud.google.com/appengine/docs/python/gettingstartedpython27/introduction

Then setup the environment. I already had Python 2.7. So installed only the GAE SDK.
https://cloud.google.com/appengine/downloads#Google_App_Engine_SDK_for_Python

Its very simple. Once we install the SDK. It will provide us an option to run our web site locally. Once we are satisfied we can push to app engine ie cloud

The helloworld sample in google help is very preliminary. So googled for little higher startup sample and I got the below link.

http://www.labnol.org/internet/host-website-on-google-app-engine/18801/

In the above link I was able to see some more better sample which deal with html files as well. I took that did some modification in html and tried to run from local app engine server. It worked fine.

Deployment

Then I tried to deploy to real GAE by clicking on the Deploy button in the GAE launcher. It opened the browser and I entered my google credentials. But unfortunately it didn't publish to my app engine. The window stayed as is with the below message

If your browser is on a different machine then exit and re-run this
application with the command-line parameter

  --noauth_local_webserver

Then I started googling and found that it happens sometimes and if we use the command based deployment it will work. I tried that and didn't succeed.

Then googled with error and language Python. Then I got another workaround to a known issue.

If the local development server is running we will not be able to deploy to GAE. I just stopped the local server and deployed. It worked.

The public url is as follows
http://joystestproject.appspot.com/


No comments: