<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Fili Wiese &#187; Django</title>
	<atom:link href="http://www.filiwiese.com/python/django/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.filiwiese.com</link>
	<description>My Two Cents on Life, The Universe and Everything</description>
	<lastBuildDate>Wed, 02 Jun 2010 21:16:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Setting up App Engine Patch Locally on Ubuntu</title>
		<link>http://www.filiwiese.com/setting-up-app-engine-patch-locally-on-ubuntu/</link>
		<comments>http://www.filiwiese.com/setting-up-app-engine-patch-locally-on-ubuntu/#comments</comments>
		<pubDate>Sun, 02 Aug 2009 15:23:28 +0000</pubDate>
		<dc:creator>Fili Wiese</dc:creator>
				<category><![CDATA[App Engine]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.filiwiese.com/?p=112</guid>
		<description><![CDATA[Since the latest release of Google App Engine SDK, Django 1.0 is officially supported by Google App Engine and in the article Unleash Django with app-engine-patch the advantages of using App Engine Patch (which allows you to use more Django functionality on Google App Engine) are well described. However the documentation of App Engine Patch [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Since the latest release of <a href="http://code.google.com/appengine/">Google App Engine</a> SDK, Django 1.0 is officially supported by Google App Engine and in the article <a href="http://code.google.com/appengine/articles/app-engine-patch.html">Unleash Django with app-engine-patch</a> the advantages of using App Engine Patch (which allows you to use more Django functionality on Google App Engine) are well described. However the documentation of App Engine Patch is lacking some detailed description on how to set this up this locally. So I decided to write this small tutorial, in which I will guide you setting up Google App Engine SDK with <a href="http://code.google.com/p/app-engine-patch/">App Engine Patch</a> on an <a href="http://www.ubuntu.com/">Ubuntu</a> machine.</p>
<h2>Why Ubuntu and not Windows?</h2>
<p>For me this is a clear-cut choice. I have stepped away from Windows about a year ago after I tried to use Windows Vista Business edition for 8 months and was almost ready to throw the computer out of the building. I have used Windows most of the last 15 years I have been working on computers but in the last few years I saw that Linux is finally able to replace most, if not all, functionalities I require/need from an operating system. And since I also like the open source movement, for me switching to Linux made sense.</p>
<p>First the <a href="http://www.debian.org/">Debian</a> distribution was my preferred choice but in the last 2 years <a href="http://www.ubuntu.com/">Ubuntu</a> has become really user friendly (offering a great user interface to Linux and frequent updates). In addition Linux operating system are especially great if you need a web development environment (although it may be challenging at times with the more graphical aspects of web development, like Flash or SilverLight). If you haven&#8217;t done recently already, I recommend you to give Linux a try! Please note that most of the steps described below can be applied to most other Linux distributions as well.</p>
<h2>Before we start&#8230;</h2>
<p>What you will need on Ubuntu for this tutorial are:</p>
<ul>
<li> A Terminal (which you can find under &#8216;Main menu &gt; Applications &gt; Accessories &gt; Terminal&#8217;)</li>
<li>A Google App Engine account (<a href="http://appengine.google.com/">apply</a>)</li>
<li>Google App Engine SDK, Python version (<a href="http://code.google.com/appengine/">download</a>)</li>
<li>App Engine Patch (<a href="http://code.google.com/p/app-engine-patch/">download</a>)</li>
<li>Python 2.5 (which is available in the Ubuntu repository)</li>
</ul>
<p>That is basically it, no more is needed :)</p>
<h2>Setting Up a Google App Engine Account</h2>
<p>In order to be able to use Google App Engine, we need to set up a free account. If you haven&#8217;t done this yet I recommend you do so by going to <a href="http://appengine.google.com/">http://appengine.google.com/</a> and sign in with your Google Account (you will need to create one if you don&#8217;t have one yet).</p>
<p>Once logged in, you have to option to &#8216;Create an Application&#8217; (see button at the bottom of the page). Click the button to create an application and fill in the form. Please note that you can not change the name (Application Identifier) after you have chosen it, nor can you delete it. Also currently you can only create a maximum of 10 applications, so I recommend you create just one for testing purposes (e.g. username-test).</p>
<p><img class="size-medium wp-image-117 alignnone" title="create an application" src="http://www.filiwiese.com/wp-content/uploads/2009/08/create-300x197.png" alt="create an application" width="300" height="197" /></p>
<p>After you are have created the application feel free to browse a little bit through the online admin interface. This is where you will be able to monitor the performance of your application once it has gone live.</p>
<h2>Setting up Google App Engine</h2>
<p>We can set up Google App Engine in several different ways. Most of the set up requires you to just download the SDK and unzip it. However for App Engine Patch we want to do go one step further. We want to register it in our PATH so we can access it from anywhere else on the computer.</p>
<p>In order to do all of this, first download the <a href="http://code.google.com/appengine/downloads.html#Google_App_Engine_SDK_for_Python">Google App Engine SDK</a> (you need to go for the Linux download!) and unzip it into your home directory (one of the ways you can do this is by right-clicking on the zip-file and click on &#8216;Extract here&#8217;).</p>
<p>Unzipping the SDK will create a new sub directory called google_appengine, with the SDK files in it. Note that if all user information is stored under /home/&lt;your-username&gt;/ then after unzipping the SDK should be accessible here:</p>
<p><code>/home/&lt;your-username&gt;/google_appengine/</code></p>
<p>in my case this would be:</p>
<p><code>/home/fili/google_appengine/</code></p>
<p>Now we want to make sure we all the files have the correct access rights. We could go very specific into detail here and give different file-types different access permissions or we could just do it simple. I choose for the later, so please open a terminal (you can find this in your main menu, under Applications and Accessories). Once you open the terminal you should be in your home directory, under your user account. To verify this, type: <code>pwd</code>. This will print out the current path you are in (see also the screenshot below).</p>
<p><img class="alignnone size-full wp-image-120" title="pwd" src="http://www.filiwiese.com/wp-content/uploads/2009/08/pwd.png" alt="pwd" width="305" height="139" /></p>
<p>Now type <code>ls</code> and verify that you have the sub directory google_appengine there.</p>
<p><img class="alignnone size-full wp-image-119" title="ls" src="http://www.filiwiese.com/wp-content/uploads/2009/08/ls.png" alt="ls" width="287" height="197" /></p>
<p>To make sure the access permissions are correct type the following command:</p>
<p><code>chmod -R 750 ~/google_appengine/</code></p>
<p>This will set all the permissions to something we can access. Now we need to make sure we can actually access the SDK from anywhere. In order to do this we need to add the sub directory to the environment PATH. In your terminal type:</p>
<p><code>pico ~/.bashrc</code></p>
<p><img class="alignnone size-full wp-image-116" title="bashrc" src="http://www.filiwiese.com/wp-content/uploads/2009/08/bashrc.png" alt="bashrc" width="405" height="158" /></p>
<p>Don&#8217;t worry if the file does not exist yet or if it is full of stuff. Once you have opened the file, find the first or second white-line, and add the following lines:</p>
<p><code># set path<br />
PATH=$PATH:$HOME/google_appengine<br />
export PATH</code></p>
<p>Now close and save this by clicking Control-O (this will save the new lines) and Control-X (this will close the nano editor). After this you need to log out of your Ubuntu session and log in again.</p>
<p>After you logged out and in again, you can verify this all worked by opening another terminal and typing:</p>
<p><code>echo $PATH</code></p>
<p>This should print something similar to the screenshot below (note the /home/fili/google_appengine at the end of the line.</p>
<p><img class="alignnone size-medium wp-image-118" title="echo" src="http://www.filiwiese.com/wp-content/uploads/2009/08/echo-300x77.png" alt="echo" width="300" height="77" /></p>
<p>The hardest part has been done now ;)</p>
<h2>Setting Up Python2.5</h2>
<p>You probably already have Python installed on your machine but this may be the wrong version. In order to work with App Engine Patch and Google App Engine SDK we need to make sure we all use the same version of Python, for which Python 2.5 is currently the best choice.</p>
<p>You can see which version is primary set up on your computer by opening a terminal and type <code>python2.5</code>. You should then get a screen like this (Control-D or typing <code>exit()</code> will get you out of this screen again):</p>
<p><img class="alignnone size-medium wp-image-121" title="python" src="http://www.filiwiese.com/wp-content/uploads/2009/08/python-300x104.png" alt="python" width="300" height="104" /></p>
<p>If you get an error message that Python can not be found, it means that it is not yet installed.</p>
<p>If you don&#8217;t have Python 2.5 installed, you will need to install it. Make sure you have an internet connection and type:</p>
<p><code>sudo apt-get update</code></p>
<p>This make sure you have the latest repository lists available. Then type this:</p>
<p><code>sudo apt-get install python2.5</code></p>
<p>Select &#8216;Yes&#8217; if asked if you want to proceed and this will install Python version 2.5 on your machine. After this process has been completed, try typing again <code>python2.5</code>.</p>
<h2>Setting Up App Engine Patch</h2>
<p>We are going to set up the App Engine Patch on our Desktop, but you can put it anywhere else on the computer.</p>
<p>First download the latest version of <a href="http://code.google.com/p/app-engine-patch/">App Engine Patch</a> to your Desktop and unzip it (similar as how you unzipped the Google App Engine SDK). A new sub directory will be created called &#8216;app-engine-patch-sample&#8217;. You can rename this sub directory to the name of your application (in my case: &#8216;fili-test&#8217;).</p>
<p>Before we can do anything else we need to change a one small settings in app.yaml. Open a terminal and type:</p>
<p><code>cd ~/Desktop/&lt;your-application-name&gt;/</code></p>
<p>For me this would translate to:</p>
<p><code>cd ~/Desktop/fili-test/</code></p>
<p>Now type:</p>
<p><code>pico app.yaml</code></p>
<p>Change the name on the first line to your application name and save the changes (Control-O) and exit the editor (Control-X):</p>
<p><img class="alignnone size-medium wp-image-115" title="appyaml" src="http://www.filiwiese.com/wp-content/uploads/2009/08/appyaml-300x198.png" alt="appyaml" width="300" height="198" /></p>
<p>Now your App Engine Patch example folder is associated with your Application Identifier. Now you can run the Google App Engine SDK with your App Engine Patch locally by typing (inside the fili-test subdirectory):</p>
<p><code>python2.5 manage.py runserver</code></p>
<p>This will start the local development server (Control-C will allow you to stop the development server again).</p>
<p><img class="alignnone size-medium wp-image-122" title="run" src="http://www.filiwiese.com/wp-content/uploads/2009/08/run-300x198.png" alt="run" width="300" height="198" /></p>
<p>If you now open your browser on <a href="http://localhost:8000/">http://localhost:8000/</a> you can see the development server running:</p>
<p><img class="alignnone size-medium wp-image-123" title="app engine patch localhost screenshot" src="http://www.filiwiese.com/wp-content/uploads/2009/08/localhost-300x178.png" alt="app engine patch localhost screenshot" width="300" height="178" /></p>
<p>That is it. You are done! Now you can start developing web applications using the powerful Django framework on Google App Engine. I recommend you to also browse through these resources about Django and Google App Engine:</p>
<ul>
<li><a href="http://code.google.com/appengine/articles/">Google App Engine Articles</a></li>
<li><a href="http://www.djangoproject.com/">Django</a> (official homepage)</li>
<li>Google App Engine SDK <a href="http://code.google.com/appengine/docs/python/gettingstarted/">Getting Started Guide</a></li>
<li><a href="http://code.google.com/appengine/docs/python/">Google App Engine Documentation</a> (Python)</li>
</ul>
<p>If you noticed any inaccuracies/errors or you are missing any steps or are running into problems, do leave a comment below!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.filiwiese.com/setting-up-app-engine-patch-locally-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
