For those innocent people who do not know Google App engine, it is a platform which lets you host your application on Google’s infrastructure. In short your code just touches the hardware which no one else, but Google’s engineers have seen. So it allows you to scale your application as you grow big.
Google app engine is pretty straight to use on almost every platform as its supports Linux, Mac OS, Windows. However some folks face issues getting it running on Linux or particularly on Ubuntu as this is the favorite distro of Linux users. Follow the steps below to install and run Google app engine on Linux.
Before we get started make sure Python is installed on your Linux box, if not yet please download and install Python from http://python.org
Download and Install Google App Engine
You can download Google App Engine from http://code.google.com/appengine/downloads.html download Python or Java version, depending on the language you are comfortable coding with. In this example we are going to download the Zip package for Python and going to save it on Ubuntu’s desktop.
Now to extract the zipped file either use the context menu to extract files into a folder or you can use terminal to unzip the files using the command – unzip google_appengine_1.2.6.zip
After you finish unzipping, you will get a folder google_appengine which has all the necessary files to develop application. To complete the installation and to able to run Google App Engine, we must specify its path definition. You can specify the PATH definition in the terminal only using – export PATH=$PATH:/home/your_user_name/Desktop/google_appengine/
But path specified using export command is valid as long as you are inside the current terminal window. That means as soon as you close the window, the path specified becomes invalid. To specify the path in the system, you have to edit the /home/your_user_name/.profile and specify the path there.
Making Your First Application on Google App Engine
All set & done, now you have the shiny Google App Engine up & running its time to do the real job. Let us make an ‘Hello World’ application for Google App Engine, using you own Linux Box – excited ? To start using app engine, you have to register an application at http://appspot.com
That requires your usual Google Account’s credentials and the environment is ready to be used instantly. Create a folder in which you will keep all your apps file. I am creating a folder named t-wave and have the application registered with the same name. Now create a file called app.yaml inside the t-wave folder and its content would be :
– url: /.*
Change the application to the one you registered at appspot.com as mentioned above.
Now our next step is to create a file that will print ‘Hello World’ when we will start the server and request the file from browser. So Create a file index.py and paste the following line.
print ‘Content-Type: text/plain’
print ‘Hello World!’
Save the file index.py and now let’s test our application locally and then we will upload it to the Google’s servers. To start the server on localhost, open terminal window and type command:
This will start server and you can view your application at http://localhost:8080
If you see ‘Hello World’ then you are good to go and upload your application online. To upload application online which you have already registered as mentioned above, use the following command in the terminal window.
appcfg.py update /home/your_user_name/Desktop/t-wave
The wizard is going to ask you for your Google Account credentials. After authenticating you can see your application up & running on the URL you chose while registering your application with http://appspot.com
Hope you enjoyed this post.
Stay Digified !!