<?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>Fighting Rabbits &#187; memory</title>
	<atom:link href="http://fightingrabbits.com/archives/category/memory/feed" rel="self" type="application/rss+xml" />
	<link>http://fightingrabbits.com</link>
	<description>and herding cats...</description>
	<lastBuildDate>Wed, 23 Jun 2010 12:28:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>Nginx &amp; Django on Webfaction (Part&#160;1a) &#8211; Installing</title>
		<link>http://fightingrabbits.com/archives/139</link>
		<comments>http://fightingrabbits.com/archives/139#comments</comments>
		<pubDate>Thu, 13 Aug 2009 22:23:31 +0000</pubDate>
		<dc:creator>Richard Cooper</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Setup]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[installation]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[webfaction]]></category>

		<guid isPermaLink="false">http://fightingrabbits.com/?p=139</guid>
		<description><![CDATA[This is aimed at Installing and configuring Django running as a FCGI Process behind Nginx on <a href="http://webfaction.com">WebFaction</a> shared hosting. Later on in this series I will be showing how to create fancy ajax upload progress indicators with most of the work done by Nginx, and also how to hand off the work of large downloads back to Nginx.]]></description>
			<content:encoded><![CDATA[<p>This is aimed at Installing and configuring Django running as a FCGI Process behind Nginx on <a href="http://webfaction.com">WebFaction</a> shared hosting but can be altered to work with an almost identical setup on Ubuntu 9.04 (Jaunty).</p>
<p>For those who don&#8217;t know Nginx (Engine X) is a Free, open-source, high-performance HTTP server and reverse proxy with the added advantage for shared hosting that it has a low memory footprint &#8211; and Django is a high-level Python Web framework with added magic ponies :)</p>
<p>I&#8217;m creating this tutorial series so that in 3 months time when I need to set this up again for another project I haven&#8217;t forgotten where I put my written notes&#8230; (This is based off several threads in the <a href="http://forum.webfaction.com">WebFaction Forum</a>, some research into Nginx, and a lot of trial and error getting the upload module to work with Django)</p>
<p>Later on in this series I will be showing how to create fancy ajax upload progress indicators with most of the work done by Nginx, and also how to hand off the work of large downloads back to Nginx.</p>
<p>Right, Let&#8217;s get started&#8230;<br />
<span id="more-139"></span><br />
First we need to create a new app in the Webfaction control panel. Create a &#8220;new app listening on port&#8221; and make a note of the port number<br />
<a href="http://fightingrabbits.com/wp-content/uploads/2009/08/create_app.png"><img class="alignnone size-medium wp-image-142" title="Create A new App" src="http://fightingrabbits.com/wp-content/uploads/2009/08/create_app-300x176.png" alt="Create A new App" width="300" height="176" /></a><br />
<a href="http://fightingrabbits.com/wp-content/uploads/2009/08/app_created.png"><img class="alignnone size-medium wp-image-141" title="Make a note of the Port Number" src="http://fightingrabbits.com/wp-content/uploads/2009/08/app_created-300x199.png" alt="Make a note of the Port Number" width="300" height="199" /></a><br />
Next we need to SSH into our account to configure and install (if you are using windows you can use the Putty SSH client.)<br />
First we need to make some sub directories in our webapp folder and install Django and Flup (needed for the FCGI support later)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>webapps<span style="color: #000000; font-weight: bold;">/&lt;</span>myapp<span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> bin lib<span style="color: #000000; font-weight: bold;">/</span>python2.5
<span style="color: #007800;">PYTHONPATH</span>=lib<span style="color: #000000; font-weight: bold;">/</span>python2.5 easy_install-<span style="color: #000000;">2.5</span> <span style="color: #660033;">-d</span> lib<span style="color: #000000; font-weight: bold;">/</span>python2.5 <span style="color: #660033;">-s</span> bin http:<span style="color: #000000; font-weight: bold;">//</span>www.djangoproject.com<span style="color: #000000; font-weight: bold;">/</span>download<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1.1</span><span style="color: #000000; font-weight: bold;">/</span>tarball<span style="color: #000000; font-weight: bold;">/</span> flup
.<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>django-admin.py startproject myproject</pre></div></div>

<p>Now we need to download and untar the latest stable versions of Nginx, Nginx_UploadProgress_Module and PCRE (for the embeded perl in Nginx)<br />
NB. If you need any other modules for Nginx now would be the time to wget them :)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>sysoev.ru<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>nginx-0.7.61.tar.gz
<span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #c20cb9; font-weight: bold;">ftp</span>:<span style="color: #000000; font-weight: bold;">//</span>ftp.csx.cam.ac.uk<span style="color: #000000; font-weight: bold;">/</span>pub<span style="color: #000000; font-weight: bold;">/</span>software<span style="color: #000000; font-weight: bold;">/</span>programming<span style="color: #000000; font-weight: bold;">/</span>pcre<span style="color: #000000; font-weight: bold;">/</span>pcre-7.9.tar.gz
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>wiki.nginx.org<span style="color: #000000; font-weight: bold;">/</span>images<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">8</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">83</span><span style="color: #000000; font-weight: bold;">/</span>Nginx_uploadprogress_module-0.5.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xzf</span> nginx-0.7.61.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xzf</span> pcre-7.9.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xzf</span> Nginx_uploadprogress_module-0.5.tar.gz</pre></div></div>

<p>Now lets configure, make and install Nginx</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> pcre-<span style="color: #000000;">7.9</span>
.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/&lt;</span>myusername<span style="color: #000000; font-weight: bold;">&gt;/</span>webapps<span style="color: #000000; font-weight: bold;">/&lt;</span>myapp<span style="color: #000000; font-weight: bold;">&gt;/</span>pcre
<span style="color: #7a0874; font-weight: bold;">cd</span> ..<span style="color: #000000; font-weight: bold;">/</span>nginx-0.7.61
.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/&lt;</span>myusername<span style="color: #000000; font-weight: bold;">&gt;/</span>webapps<span style="color: #000000; font-weight: bold;">/&lt;</span>myapp<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #660033;">--with-pcre</span>=<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/&lt;</span>myusername<span style="color: #000000; font-weight: bold;">&gt;/</span>webapps<span style="color: #000000; font-weight: bold;">/&lt;</span>myapp<span style="color: #000000; font-weight: bold;">&gt;/</span>pcre-<span style="color: #000000;">7.9</span><span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">--add-module</span>=<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/&lt;</span>myusername<span style="color: #000000; font-weight: bold;">&gt;/</span>webapps<span style="color: #000000; font-weight: bold;">/&lt;</span>myapp<span style="color: #000000; font-weight: bold;">&gt;/</span>nginx_uploadprogress_module<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>Assuming we don&#8217;t have any errors</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>Now lets clean up before going any further</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> ..
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-fr</span> nginx-0.7.61
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #000000; font-weight: bold;">*</span>.gz
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-fr</span> pcre-<span style="color: #000000;">7.9</span></pre></div></div>

<p>At this point we should have a working install of Nginx and Django, in Part 1b we will show how to configure them both and get our first page served.</p>
]]></content:encoded>
			<wfw:commentRss>http://fightingrabbits.com/archives/139/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>WebFaction Easy-Install useage.</title>
		<link>http://fightingrabbits.com/archives/125</link>
		<comments>http://fightingrabbits.com/archives/125#comments</comments>
		<pubDate>Sat, 01 Aug 2009 11:37:40 +0000</pubDate>
		<dc:creator>Richard Cooper</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[easy_install]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[webfaction]]></category>

		<guid isPermaLink="false">http://fightingrabbits.com/?p=125</guid>
		<description><![CDATA[I&#8217;m posting this here so that I can remember it :) If you need a Python library to be available to *all* of your Python apps, then install it in the $HOME/lib/python2.5 directory. A shorter version of the command is: Code: 1 easy_install-2.5 -s $HOME/bin -d $HOME/lib/python2.5 the_module_name If you need a Python library to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m posting this here so that I can remember it :)</p>
<p>If you need a Python library to be available to *all* of your Python apps, then install it in the $HOME/lib/python2.5 directory. A shorter version of the command is:<br />
<strong>Code:</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">easy_install-<span style="color: #000000;">2.5</span> <span style="color: #660033;">-s</span> <span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>bin <span style="color: #660033;">-d</span> <span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>python2.5 the_module_name</pre></td></tr></table></div>

<p>If you need a Python library to be available to *one* of your Python apps, then install it in the $HOME/webapps/<appname>/lib/python2.5 directory for that app. You must preface the easy_install command with the PYTHONPATH variable, like so:<br />
<strong>Code:</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">PYTHONPATH</span>=<span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>webapps<span style="color: #000000; font-weight: bold;">/&lt;</span>appname<span style="color: #000000; font-weight: bold;">&gt;/</span>lib<span style="color: #000000; font-weight: bold;">/</span>python2.5 easy_install-<span style="color: #000000;">2.5</span> <span style="color: #660033;">-s</span> <span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>webapps<span style="color: #000000; font-weight: bold;">/&lt;</span>appname<span style="color: #000000; font-weight: bold;">&gt;/</span>bin <span style="color: #660033;">-d</span> <span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>webapps<span style="color: #000000; font-weight: bold;">/&lt;</span>appname<span style="color: #000000; font-weight: bold;">&gt;/</span>lib<span style="color: #000000; font-weight: bold;">/</span>python2.5 the_module_name</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://fightingrabbits.com/archives/125/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
