Tags: , , , , | Categories: Google App Engine Posted by Admin on 2/5/2011 5:10 PM | Comments (0)

Todays challenge is setup Python 2.5 in Ubuntu and deploy a sample application to Google App Engine. I chose Python over Java, since I don’t know much about Python and Django. Okay, it’s time to figure out

In my setup, I am using Windows 7 and running Ubuntu 10 in Virtual Box

Before installing python, lets first install Eclipse and eclipse won't run without Java jre's. First you need to download jre, first we need to add a list of sources to the sources.list file so that we may download the java jre and jdks using sudo apt-get install command. In order to do that
  • go to /etc/apt/ folder
  • double click the sources.list
  • Go to Other Software tab
  • Press Add button at the left bottom of the dialog
  • add the following: 
    deb http://us.archive.ubuntu.com/ubuntu/ hardy multiverse



install java in ubuntu
  • open up a terminal client
  • run the command 
    sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts


Also a handy link to install Eclipse in Ubuntu
https://help.ubuntu.com/community/EclipseIDE

Install google app engine Eclipse extensions
http://code.google.com/eclipse/docs/install-eclipse-3.6.html

Install Pydev - Python development extension for Eclipse 
http://pydev.org/manual_101_install.html

Ubuntu 10 comes with python 2.6 but in order to run Google App Engine without any problems when deployed, you need to download and setup Python 2.5 because that is what the App Engine works right now. If you try to install python 2.5 with 
sudo apt-get install phyton2.5
 you are going to fail my friend. Let’s see how we can install python 2.5

I have found the following web site http://kovshenin.com/archives/installing-python-2-5-on-ubuntu-linux-10-10/
which describes the steps to install 2.5

sudo add-apt-repository ppa:fkrull/deadsnakes

sudo apt-get update

sudo apt-get install python2.5


and if you run the command
python2.5

you will see an output like this;
Python 2.5.5 (r255:77872, Sep 14 2010, 15:51:01)


Setting up interpreter in Eclipse
http://pydev.org/manual_101_interpreter.html

Download Google App Engine Pyhton SDK
http://code.google.com/appengine/downloads.html and extract it to a folder ; e.g /home/bahadir/AppEngine/

Create a new Google App Engine Project

Select the location of the Google App Engine Python SDK



After your first test project created, you can click the Google App Engine deploy button. I guess, I don’t have the deploy settings for python, I got an error, “this is not a google app engine project”. Thus, I go back to basics, fire up the terminal.

To run your project locally, you may use the development server for app engine which is found in the Google App Engine SDK. The parameter is the location of your application which app.yaml is located.

./dev_appserver.py /home/bahadir/workspace/guesswhat/src/


In order to upload your application to google engine use the following command


./appcfg.py --application=cambelb --email=me@bahadircambel.com update /home/bahadir/workspace/guesswhat/src/


  • -- application is the name of the application id you set in your google app engine
  • -- email is your login email

At the initial run of the appcfg script, you may be prompt to enter your password information, if your email is not already authenticated.

Here is the output
  • ./appcfg.py:42: DeprecationWarning: the sha module is deprecated; use the hashlib module instead os.path.join(DIR_PATH, 'lib', 'django'), /home/bahadir/AppEngine/google_appengine/google/appengine/tools/dev_appserver_login.py:33: DeprecationWarning: the md5 module is deprecated; use hashlib instead
  • import md5
  • Application: cambelb (was: wishiremember); version: 1.
  • Server: appengine.google.com.
  • Scanning files on local disk.
  • Initiating update.
  • Cloning 2 application files.
  • Uploading 2 files and blobs.
  • Uploaded 2 files and blobs
  • Precompilation starting.
  • Precompilation completed.
  • Deploying new version.
  • Checking if new version is ready to serve.
  • Will check again in 1 seconds.
  • Checking if new version is ready to serve.
  • Will check again in 2 seconds.
  • Checking if new version is ready to serve.
  • Closing update: new version is ready to start serving.
Now you can navigate to your application: 

http://cambelb.appspot.com

When I use my gmail account, I had some trouble to upload my application to the Google App Engine. I decided to switch to my domain and use that account ( bahadircambel.com ) and worked! 

 

 

blog comments powered by Disqus