<?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>REVERT TO CONSOLE &#187; Python</title>
	<atom:link href="http://www.reverttoconsole.com/blog/category/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.reverttoconsole.com</link>
	<description>for f in *;do echo &#124; sed 'i\rtc' &#62;&#62; $f;done;</description>
	<lastBuildDate>Sat, 10 Jul 2010 12:40:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Simple Processes: Bash vs. Python &#8211; &#8220;A No-Brainer&#8221;</title>
		<link>http://www.reverttoconsole.com/blog/nix/simple-tasks-bash-vs-python-a-no-brainer/</link>
		<comments>http://www.reverttoconsole.com/blog/nix/simple-tasks-bash-vs-python-a-no-brainer/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 05:15:19 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[*NIX]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[xmms2 scripts track length]]></category>

		<guid isPermaLink="false">http://www.reverttoconsole.com/?p=535</guid>
		<description><![CDATA[I haven&#8217;t posted in about 5 billion years. Well, it seems like that anyway. As I sit here partying with my laptop on a Friday night, I&#8217;ve been wondering how to display the track length of the current track that xmms2 is playing, without having to use the &#8220;xmms2 status&#8221; command. Yes, I listen to [...]]]></description>
			<content:encoded><![CDATA[<p>I haven&#8217;t posted in about 5 billion years.  Well, it seems like that anyway.  As I sit here partying with my laptop on a Friday night, I&#8217;ve been wondering how to display the track length of the current track that xmms2 is playing, without having to use the &#8220;xmms2 status&#8221; command.  Yes, I listen to and control all my music via a full-featured music player/manager from the command line (xmms2).  The problem with using the &#8220;status&#8221; command, is that it just prints out a continuous status of what&#8217;s playing and it just keeps going, which is exactly what it&#8217;s supposed to do.  It&#8217;s just like &#8220;tail -f&#8221;, So you have to ctrl-c to get out of it.  Yes. That is my sole motivation for doing this, to avoid ctrl-c.  Well, and maybe to learn a thing or two, but mostly out of defiance of having to use ctrl-c.  </p>
<p>So I figured, hey I know enough bash to at least get something rolling in order to do this.  Of course I had to keep looking stuff up in reference guides and on websites, because there&#8217;s no way I can remember it all.  Basically, it came down to 4 key tools for going the bash route.</p>
<p>1. sed &#8211; to strip brackets, slashes, colons, spaces, and other undesired characters in order to make the strings easier to deal with<br />
2. awk &#8211;  to find the location of decimal points or other characters<br />
3. cut &#8211; to get characters to the left or right of decimal points<br />
4. bc &#8211; to calculate and convert the milliseconds to human readable form </p>
<p>I finally got it to work reliably tonight.<br />
It was a horrid process that took forever.  What a waste of time.  But hey, that&#8217;s all part of the RTC experience!<br />
So here it is, please excuse the bad variable names and sloppiness. I was too pissed to give a ****.<br />
Note: I renamed this to xmms2tracklensafe and cut out all the curse words and tried to put some sense into the comments.</p>
<pre class="brush: java">
#!/bin/bash
tmpfileinfo=xtemp14251.tmp
tmpfile=xtemp91839.tmp
#use xmms2 info here
xmms2 info &gt; $tmpfileinfo
vargrep=$(grep &quot;duration&quot; $tmpfileinfo)
echo $vargrep &gt; $tmpfileinfo
#chopping the brackets, slashes, and spaces out of the string
sed -i &#039;s/\[//g&#039; $tmpfileinfo
sed -i &#039;s/\]//g&#039; $tmpfileinfo
sed -i &#039;s/\///g&#039; $tmpfileinfo
sed -i &#039;s/&#039;\ &#039;//g&#039; $tmpfileinfo
#convert the = to an X, easy to find
sed -i &#039;s/\=/X/g&#039; $tmpfileinfo
#for an mp3 - pluginmaddurationX
sed -i &#039;s/\pluginmaddurationX//g&#039; $tmpfileinfo
#for a flac - pluginflacdurationX
sed -i &#039;s/\pluginflacdurationX//g&#039; $tmpfileinfo
#God knows what other codecs there might be
#prints the time in milliseconds
echo &quot;$(cat $tmpfileinfo) ms&quot;
vargrep2=$(cat $tmpfileinfo)
varx=$vargrep2
#convert the time to minutes
var2=$(echo &quot;$varx/1000/60&quot; | bc -l)
echo $var2 &gt; $tmpfile
#we are left with a fraction of a minute, which occurs after the decimal, we need to find the decimal point
var3=$(awk &#039;BEGIN { print index(&#039;$var2&#039;, &quot;.&quot;) }&#039;)
#get the characters after the decimal point, this is our fraction of a minute
var4=$(cut -c $var3- $tmpfile)
#convert that fraction of a minute into seconds
var5=$(echo &quot;scale=1; $var4*60&quot; | bc -l | xargs printf &quot;%1.0f&quot;)
#simply subtracting a 1 from the index of the decimal point, to be used in order to retrieve the number left of the decimal
varcut=$(echo &quot;$var3 - 1&quot; | bc -l | xargs printf &quot;%1.0f&quot;)
#gets the number to the left of the decimal
var6=$(cut -c -$varcut $tmpfile)
#now we need to deal with the decimal in the number that has been converted to seconds
var7=$(awk &#039;BEGIN { print index(&#039;$var5&#039;, &quot;.&quot;) }&#039;)
varcut2=1
#I honestly don&#039;t remember why I did this.  I think I needed it before I started adding | xargs printf &quot;%1.0f&quot;
if [ &quot;0&quot; != $var7 ]
	then
		varcut2=$(echo &quot;$var7 - 1&quot; | bc -l | xargs printf &quot;%1.0f&quot;)
fi

echo $var5 &gt; $tmpfile
#now we get the seconds as a whole number, by getting the characters left of the decimal
var8=$(cut -c -$varcut2 $tmpfile)
var8=$(cat $tmpfile)

#need to prepend a 0 to the seconds if they are under 10
if [ $var8 -lt 10 ]
	then
		var8=&quot;0$var8&quot;
fi

#print out the time in human readable form, minutes : seconds
echo &quot;$var6:$var8&quot;
#clean up the temp files
rm -f $tmpfile
rm -f $tmpfileinfo
</pre>
<p>Wow, what a pain in the pee-hole.  It took me several hours over two nights and I even lost some sleep over it.  So, I decided to try it Jeff&#8217;s way, using Python, since he brags about it so much.  I had never used it before, and now that I have, I think I&#8217;ll be using it a lot!  A lot of you are saying, &#8220;Well yeah, duh. Idiot.&#8221; or something more insulting, and I fully accept that.  In fact, I encourage it!</p>
<p>First, we have the simple bash script that is used to execute the entire process from the command line.</p>
<pre class="brush: java">
#!/bin/bash

tmpfile=assscrambler124524.tmp
xmms2 info &gt; $tmpfile

python ~/scripts/xmms2len.py

rm -f $tmpfile
</pre>
<p>And now we have the giant, complex, and horrendous python script.</p>
<pre class="brush: java">
file = open(&#039;./assscrambler124524.tmp&#039;)
for line in file:
	if(line.find(&#039;duration&#039;,0) &gt; -1) :
		#print(line)
		s = line
		searchstr = &#039;duration = &#039;;
		x = s.rindex(searchstr, 0);
		if(x &gt; -1):
			timeMillis = s[x+len(searchstr):len(s)].strip()
			#print(timeMillis)
			timeConverted = float(timeMillis)/1000/60
			#print(timeConverted);
			stime = str(timeConverted)
			decIndex = stime.rindex(&#039;.&#039;, 0)
			timeFraction = float(stime[decIndex:len(stime)])
			seconds = int(round(timeFraction*60,0))
			strseconds = str(seconds)
			minutes = stime[0:decIndex]
			strminutes = str(minutes)
			if(seconds &lt; 10) :
				strseconds = &#039;0&#039; + str(seconds)
			print(timeMillis + &#039; ms\n&#039; + str(minutes) + &#039;:&#039; + strseconds)
			break
</pre>
<p>Wait, that&#8217;s it?  Just some simple searches, substrings, calculations, easy conversions between types, and that&#8217;s all?  Not to mention the incredibly easy way to open a file and iterate through its lines.<br />
Now, I commented out some print statements here, and I could have compacted it more, but I wanted it to be reasonably clear.  The point of course, and 95% of you know probably know this already, is that python kicks bash&#8217;s ass when it comes to things that should be, well, programs.  Of course bash scripts will always have their place, and they are necessary for so many things.  I still love bash and am very fond of it, but from a programming perspective, it just doesn&#8217;t &#8220;cut the mustard&#8221;, as Jeff would say.</p>
<p>Well, that&#8217;s it for my exciting Friday night.  Someday I&#8217;ll get my crap together and talk more about my xmms2 setup, the xmms2 python equalizer, the xmms2 scrobbler for last.fm, and the other scripts I&#8217;ve written for xmms2.</p>
<p>Cya!</p>
<p>My main reference for python: <a href="http://www.astro.ufl.edu/~warner/prog/python.html">http://www.astro.ufl.edu/~warner/prog/python.html</a></p>

<span class="slashdigglicious">
<a href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fnix%2Fsimple-tasks-bash-vs-python-a-no-brainer%2F&amp;title=Simple+Processes%3A+Bash+vs.+Python+%26%238211%3B+%26%238220%3BA+No-Brainer%26%238221%3B" title="Slashdot It!"><img src="http://slashdot.org/favicon.ico" height="16" width="16" alt="[Slashdot]" /></a>
<a href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fnix%2Fsimple-tasks-bash-vs-python-a-no-brainer%2F&amp;title=Simple+Processes%3A+Bash+vs.+Python+%26%238211%3B+%26%238220%3BA+No-Brainer%26%238221%3B" title="Digg This Story"><img src="http://digg.com/favicon.ico" width="16" height="16" alt="[Digg]" /></a>
<a href="http://reddit.com/submit?url=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fnix%2Fsimple-tasks-bash-vs-python-a-no-brainer%2F&amp;title=Simple+Processes%3A+Bash+vs.+Python+%26%238211%3B+%26%238220%3BA+No-Brainer%26%238221%3B" title="Reddit"><img src="http://reddit.com/favicon.ico" width="16" height="16" alt="[Reddit]" /></a>
<a href="http://del.icio.us/post?url=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fnix%2Fsimple-tasks-bash-vs-python-a-no-brainer%2F&amp;title=Simple+Processes%3A+Bash+vs.+Python+%26%238211%3B+%26%238220%3BA+No-Brainer%26%238221%3B" title="Save to del.icio.us" onclick="window.open('http://del.icio.us/post?v=4&amp;noui&amp;jump=close&amp;url=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fnix%2Fsimple-tasks-bash-vs-python-a-no-brainer%2F&amp;title=Simple+Processes%3A+Bash+vs.+Python+%26%238211%3B+%26%238220%3BA+No-Brainer%26%238221%3B', 'delicious', 'toolbar=no,width=700,height=400'); return false;"><img src="http://images.del.icio.us/static/img/delicious.small.gif" width="16" height="16" alt="[del.icio.us]" /></a>
<a href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fnix%2Fsimple-tasks-bash-vs-python-a-no-brainer%2F" title="Share on Facebook"><img src="http://www.facebook.com/favicon.ico" width="16" height="16" alt="[Facebook]" /></a>
<a href="http://technorati.com/faves?add=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fnix%2Fsimple-tasks-bash-vs-python-a-no-brainer%2F" title="Add to my Technorati Favorites"><img src="http://technorati.com/favicon.ico" width="16" height="16" alt="[Technorati]" /></a>
<a href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fnix%2Fsimple-tasks-bash-vs-python-a-no-brainer%2F&amp;title=Simple+Processes%3A+Bash+vs.+Python+%26%238211%3B+%26%238220%3BA+No-Brainer%26%238221%3B" title="Save to Google Bookmarks"><img src="http://www.google.com/favicon.ico" width="16" height="16" alt="[Google]" /></a>
<a href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fnix%2Fsimple-tasks-bash-vs-python-a-no-brainer%2F&amp;title=Simple+Processes%3A+Bash+vs.+Python+%26%238211%3B+%26%238220%3BA+No-Brainer%26%238221%3B" title="Stumble it!"><img src="http://www.stumbleupon.com/favicon.ico" width="16" height="16" alt="[StumbleUpon]" /></a>
</span>]]></content:encoded>
			<wfw:commentRss>http://www.reverttoconsole.com/blog/nix/simple-tasks-bash-vs-python-a-no-brainer/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Dreamhost Django Install, Revised Edition</title>
		<link>http://www.reverttoconsole.com/blog/django/dreamhost-django-install-revised-edition/</link>
		<comments>http://www.reverttoconsole.com/blog/django/dreamhost-django-install-revised-edition/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 20:28:45 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.reverttoconsole.com/?p=469</guid>
		<description><![CDATA[I recently went back to doing some Django development after a long lapse, and decided to start by eating my own dogfood&#8230; I started by upgrading Python for my Dreamhost user. I followed my own post, except that I used Python 2.6 instead of 2.5. I missed one step that was caught by a pingback [...]]]></description>
			<content:encoded><![CDATA[<p>I recently went back to doing some Django development after a long lapse, and decided to start by eating my own dogfood&#8230;</p>
<p>I started by upgrading Python for my Dreamhost user. I <a href="http://www.reverttoconsole.com/blog/nix/upgrading-python-on-a-dreamhost-account/">followed my own post</a>, except that I used Python 2.6 instead of 2.5. I missed one step that was caught by a <a href="http://blog.p-for-productivity.com/?p=95">pingback post</a>:</p>
<p>In addition to the steps I outlined before:</p>
<pre class="brush: sh">
$ mkdir opt
$ mkdir downloads
$ cd downloads
$ wget http://www.python.org/ftp/python/2.6.4/Python-2.6.4.tgz
$ tar xvzf Python-2.6.4.tgz
$ cd Python-2.6.4
$ ./configure --prefix=$HOME/opt/ --enable-unicode=ucs4
$ make
$ make install
</pre>
<p>Next append </p>
<p>export PATH=$HOME/opt/bin/:$PATH</p>
<p>to your .bash_profile. Then test (from your home dir):</p>
<pre class="brush: sh">
$ source .bash_profile
$ python -V
Python 2.6.4
</pre>
<p>If you don’t see Python 2.6.4 after typing python -V then you’ve already done something wrong.</p>
<p>I had to install the Python setuptools:</p>
<pre class="brush: sh">
$ wget http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c9-py2.6.egg
$ sh setuptools-0.6c9-py2.6.egg
</pre>
<p>before installing Mysql-Python as before:</p>
<pre class="brush: sh">
$ wget http://downloads.sourceforge.net/project/mysql-python/mysql-python-test/1.2.3c1/MySQL-python-1.2.3c1.tar.gz
$ tar xvzf MySQL-python-1.2.2.tar.gz
$ cd MySQL-python-1.2.2
$ python setup.py install
</pre>
<p>So this brought me to the point where I had an updated version of Python on my Dreamhost account.</p>
<p>Next to set up Django.</p>
<p>I looked at setting up Django with the Dreamhost script, which didn&#8217;t seem to work for me but I don&#8217;t remember why not. In the end I found <a href="http://www.soasi.com/2008/09/django-10-on-dreamhost-with-passenger-mod_rails/">SOASI&#8217;s post</a> the most useful, although I did it a little differently.</p>
<p>First up, configure your domain.</p>
<p>In Dreamhost panel -> Domains -> Manage Domains click on the domain you want to put your app on (in the example we will set domain.com), and activate “Ruby on Rails Passenger (mod_rails)” option.</p>
<p>Create a public directory in that domain.</p>
<p>Next make sure you have your database setup. You don&#8217;t have to have a database for Django now, but if you plan to use one now is a good time to get that set up.</p>
<p>Next I downloaded and installed Django.</p>
<p>I liked the directory structure suggested by Dreamhost. This will work well for having one Django directory and use it for multiple projects on multiple domains.</p>
<pre class="brush: sh">
 /home/username/django/
   source (your django svn checkout, or skip it and use Dreamhost&#039;s site-package of Django)
   projects
   applications (any reusable applications shared between projects)
</pre>
<p>Finally, I added the media and admin media, and also the passenger_wsgi.py</p>
<pre class="brush: sh">
import sys, os
if sys.version &amp;lt; &amp;quot;2.6&amp;quot;: os.execl(&amp;quot;/home/user/opt/bin/python2.6&amp;quot;, &amp;quot;python2.6&amp;quot;, *sys.ar
gv)
sys.path.insert(1, &amp;quot;/home/user/django/source&amp;quot;)
sys.path.insert(1, &amp;quot;/home/user/django/applications&amp;quot;)
sys.path.insert(1, &amp;quot;/home/user/django/projects&amp;quot;)
os.environ[&#039;DJANGO_SETTINGS_MODULE&#039;] = &amp;quot;project.settings&amp;quot;
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
</pre>
<p>On /home/user/django/projects/myproject/settings.py file check settings:</p>
<pre class="brush: sh">
MEDIA_ROOT = &#039;/home/user/domain.com/public/media/&#039;
MEDIA_URL = &#039;http://www.domain.com/media/&#039;
ADMIN_MEDIA_PREFIX = &#039;/admin_media/&#039;
</pre>
<p>Create a symbolic link for admin_media:</p>
<pre class="brush: sh">
cd /home/user/domain.com/public/
ln -s home/user/django/source/contrib/admin/media/ admin_media
</pre>
<p>Django and Python are still new to me, so you get what you pay for with this setup.</p>
<p>Note:<br />
<a href="http://coltonprovias.com/2009/09/21/django-on-dreamhost-with-passenger/">I found this today</a>, and it looks like it could be a good setup too.</p>

<span class="slashdigglicious">
<a href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fdjango%2Fdreamhost-django-install-revised-edition%2F&amp;title=Dreamhost+Django+Install%2C+Revised+Edition" title="Slashdot It!"><img src="http://slashdot.org/favicon.ico" height="16" width="16" alt="[Slashdot]" /></a>
<a href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fdjango%2Fdreamhost-django-install-revised-edition%2F&amp;title=Dreamhost+Django+Install%2C+Revised+Edition" title="Digg This Story"><img src="http://digg.com/favicon.ico" width="16" height="16" alt="[Digg]" /></a>
<a href="http://reddit.com/submit?url=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fdjango%2Fdreamhost-django-install-revised-edition%2F&amp;title=Dreamhost+Django+Install%2C+Revised+Edition" title="Reddit"><img src="http://reddit.com/favicon.ico" width="16" height="16" alt="[Reddit]" /></a>
<a href="http://del.icio.us/post?url=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fdjango%2Fdreamhost-django-install-revised-edition%2F&amp;title=Dreamhost+Django+Install%2C+Revised+Edition" title="Save to del.icio.us" onclick="window.open('http://del.icio.us/post?v=4&amp;noui&amp;jump=close&amp;url=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fdjango%2Fdreamhost-django-install-revised-edition%2F&amp;title=Dreamhost+Django+Install%2C+Revised+Edition', 'delicious', 'toolbar=no,width=700,height=400'); return false;"><img src="http://images.del.icio.us/static/img/delicious.small.gif" width="16" height="16" alt="[del.icio.us]" /></a>
<a href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fdjango%2Fdreamhost-django-install-revised-edition%2F" title="Share on Facebook"><img src="http://www.facebook.com/favicon.ico" width="16" height="16" alt="[Facebook]" /></a>
<a href="http://technorati.com/faves?add=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fdjango%2Fdreamhost-django-install-revised-edition%2F" title="Add to my Technorati Favorites"><img src="http://technorati.com/favicon.ico" width="16" height="16" alt="[Technorati]" /></a>
<a href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fdjango%2Fdreamhost-django-install-revised-edition%2F&amp;title=Dreamhost+Django+Install%2C+Revised+Edition" title="Save to Google Bookmarks"><img src="http://www.google.com/favicon.ico" width="16" height="16" alt="[Google]" /></a>
<a href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fdjango%2Fdreamhost-django-install-revised-edition%2F&amp;title=Dreamhost+Django+Install%2C+Revised+Edition" title="Stumble it!"><img src="http://www.stumbleupon.com/favicon.ico" width="16" height="16" alt="[StumbleUpon]" /></a>
</span>]]></content:encoded>
			<wfw:commentRss>http://www.reverttoconsole.com/blog/django/dreamhost-django-install-revised-edition/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Django on Dreamhost</title>
		<link>http://www.reverttoconsole.com/blog/nix/django-on-dreamhost/</link>
		<comments>http://www.reverttoconsole.com/blog/nix/django-on-dreamhost/#comments</comments>
		<pubDate>Sun, 28 Sep 2008 15:41:25 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[*NIX]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://reverttoconsole.com/?p=237</guid>
		<description><![CDATA[It doesn&#8217;t take much searching to suspect that Django on Dreamhost maby not be an ideal environment, but it does work. Running Django on Dreamhost involves using Fastcgi, which is officially supported by Django, but not a recommended configuration. I found following the official tutorial sufficient in setting up Django on Dreamhost. A couple of [...]]]></description>
			<content:encoded><![CDATA[<p>It doesn&#8217;t take much searching to suspect that <a href="http://www.djangoproject.com/">Django</a> on <a href="http://dreamhost.com/">Dreamhost</a> maby not be an ideal environment, but it does work. Running Django on Dreamhost involves using <a href="http://www.fastcgi.com/drupal/">Fastcgi</a>, which is officially supported by Django, but not a recommended configuration.</p>
<p>I found following <a href="http://wiki.dreamhost.com/index.php/Django">the official tutorial</a> sufficient in setting up Django on Dreamhost.</p>
<p>A couple of notes from this install:</p>
<ol>
<li>There are a several sites that mention what to do after you make code changes, and have already accessed the site. I have found that &#8220;touch ~/mysite/dispatch.fcgi&#8221; is sufficient to reload my changes. But several sites mention performing a pkill or pkill -9 python2.5.  I can see there are a couple of dispatch.fcgi processes running, but I haven&#8217;t seen a need to kill them yet, so I&#8217;m sticking with the touch command at this point.</li>
<li>I had to uncheck Extra Web Security for my Django domain in the dreamhost panel to get it to run correctly. I&#8217;ll double check this as I get development going, as it looks like others have Django running with extra web security enabled.</li>
</ol>
<p><strong>References:</strong></p>
<ul>
<li><a href="http://jeffcroft.com/blog/2006/may/11/django-dreamhost/">Jeff Croft&#8217;s Tutorial</a> provides another description of essentially the same process. Keep in mind that this is 2 years old however.</li>
<li><a href="http://blog.localkinegrinds.com/2007/03/29/my-dreamhost-django-subversion-setup/">Ryan Kanno provides a cool idea for a development cycle in this environment</a></li>
</ul>

<span class="slashdigglicious">
<a href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fnix%2Fdjango-on-dreamhost%2F&amp;title=Django+on+Dreamhost" title="Slashdot It!"><img src="http://slashdot.org/favicon.ico" height="16" width="16" alt="[Slashdot]" /></a>
<a href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fnix%2Fdjango-on-dreamhost%2F&amp;title=Django+on+Dreamhost" title="Digg This Story"><img src="http://digg.com/favicon.ico" width="16" height="16" alt="[Digg]" /></a>
<a href="http://reddit.com/submit?url=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fnix%2Fdjango-on-dreamhost%2F&amp;title=Django+on+Dreamhost" title="Reddit"><img src="http://reddit.com/favicon.ico" width="16" height="16" alt="[Reddit]" /></a>
<a href="http://del.icio.us/post?url=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fnix%2Fdjango-on-dreamhost%2F&amp;title=Django+on+Dreamhost" title="Save to del.icio.us" onclick="window.open('http://del.icio.us/post?v=4&amp;noui&amp;jump=close&amp;url=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fnix%2Fdjango-on-dreamhost%2F&amp;title=Django+on+Dreamhost', 'delicious', 'toolbar=no,width=700,height=400'); return false;"><img src="http://images.del.icio.us/static/img/delicious.small.gif" width="16" height="16" alt="[del.icio.us]" /></a>
<a href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fnix%2Fdjango-on-dreamhost%2F" title="Share on Facebook"><img src="http://www.facebook.com/favicon.ico" width="16" height="16" alt="[Facebook]" /></a>
<a href="http://technorati.com/faves?add=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fnix%2Fdjango-on-dreamhost%2F" title="Add to my Technorati Favorites"><img src="http://technorati.com/favicon.ico" width="16" height="16" alt="[Technorati]" /></a>
<a href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fnix%2Fdjango-on-dreamhost%2F&amp;title=Django+on+Dreamhost" title="Save to Google Bookmarks"><img src="http://www.google.com/favicon.ico" width="16" height="16" alt="[Google]" /></a>
<a href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fnix%2Fdjango-on-dreamhost%2F&amp;title=Django+on+Dreamhost" title="Stumble it!"><img src="http://www.stumbleupon.com/favicon.ico" width="16" height="16" alt="[StumbleUpon]" /></a>
</span>]]></content:encoded>
			<wfw:commentRss>http://www.reverttoconsole.com/blog/nix/django-on-dreamhost/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrading Python on a Dreamhost Account</title>
		<link>http://www.reverttoconsole.com/blog/nix/upgrading-python-on-a-dreamhost-account/</link>
		<comments>http://www.reverttoconsole.com/blog/nix/upgrading-python-on-a-dreamhost-account/#comments</comments>
		<pubDate>Sun, 28 Sep 2008 15:06:53 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[*NIX]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://reverttoconsole.com/?p=228</guid>
		<description><![CDATA[Java is just my day job. In fact, it&#8217;s pretty dull too sometimes. I like to venture out when I can and work with other technologies. In this case, I&#8217;ve been messing around with Django on my Dreamhost account. This short tutorial is intended to be the first of several related to Python and Django. [...]]]></description>
			<content:encoded><![CDATA[<p>Java is just my day job. In fact, it&#8217;s pretty dull too sometimes. I like to venture out when I can and work with other technologies. In this case, I&#8217;ve been messing around with <a href="http://www.djangoproject.com/">Django</a> on my <a href="http://www.dreamhost.com/">Dreamhost</a> account. This short tutorial is intended to be the first of several related to Python and Django.</p>
<p>Ssh to your DH account, from the base dir&#8230;</p>
<pre class="brush: sh">
$ mkdir opt
$ mkdir downloads
$ cd downloads
$ wget http://www.python.org/ftp/python/2.5.2/Python-2.5.2.tgz
$ tar xvzf Python-2.5.2.tgz
$ cd Python-2.5.2
$ ./configure --prefix=$HOME/opt/ --enable-unicode=ucs4
$ make
$ make install
</pre>
<p>If that completes correctly, you can remove the tarball and the Python2.5.2 directory.</p>
<p>Next, update your path by adding:</p>
<blockquote><p>export PATH=$HOME/opt/bin/:$PATH</p></blockquote>
<p>to your .bash_profile. Then test:</p>
<pre class="brush: sh">
$ source .bash_profile
$ python -V
Python 2.5.2
</pre>
<p>If you don&#8217;t see Python 2.5.2 after typing python -V then you&#8217;ve already done something wrong.</p>
<p>Next, update MySql-Python (from the downloads directory):</p>
<pre class="brush: sh">
$ wget http://internap.dl.sourceforge.net/sourceforge/mysql-python/MySQL-python-1.2.2.tar.gz
$ tar xvzf MySQL-python-1.2.2.tar.gz
$ cd MySQL-python-1.2.2
$ python setup.py install
</pre>
<p>Make sure the files extract into the ~/opt/lib/python2.5/site-packages/ directory as an <a href="http://peak.telecommunity.com/DevCenter/PythonEggs">egg file</a>.</p>
<p>Now that we have everything upgraded nicely, we can move on to installing Django.</p>
<p><strong>References:</strong></p>
<p><a href="http://blog.localkinegrinds.com/2007/08/20/custom-python-installation-for-django-on-dreamhost/">Custom Python Install by LocalKineGrinds</a></p>

<span class="slashdigglicious">
<a href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fnix%2Fupgrading-python-on-a-dreamhost-account%2F&amp;title=Upgrading+Python+on+a+Dreamhost+Account" title="Slashdot It!"><img src="http://slashdot.org/favicon.ico" height="16" width="16" alt="[Slashdot]" /></a>
<a href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fnix%2Fupgrading-python-on-a-dreamhost-account%2F&amp;title=Upgrading+Python+on+a+Dreamhost+Account" title="Digg This Story"><img src="http://digg.com/favicon.ico" width="16" height="16" alt="[Digg]" /></a>
<a href="http://reddit.com/submit?url=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fnix%2Fupgrading-python-on-a-dreamhost-account%2F&amp;title=Upgrading+Python+on+a+Dreamhost+Account" title="Reddit"><img src="http://reddit.com/favicon.ico" width="16" height="16" alt="[Reddit]" /></a>
<a href="http://del.icio.us/post?url=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fnix%2Fupgrading-python-on-a-dreamhost-account%2F&amp;title=Upgrading+Python+on+a+Dreamhost+Account" title="Save to del.icio.us" onclick="window.open('http://del.icio.us/post?v=4&amp;noui&amp;jump=close&amp;url=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fnix%2Fupgrading-python-on-a-dreamhost-account%2F&amp;title=Upgrading+Python+on+a+Dreamhost+Account', 'delicious', 'toolbar=no,width=700,height=400'); return false;"><img src="http://images.del.icio.us/static/img/delicious.small.gif" width="16" height="16" alt="[del.icio.us]" /></a>
<a href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fnix%2Fupgrading-python-on-a-dreamhost-account%2F" title="Share on Facebook"><img src="http://www.facebook.com/favicon.ico" width="16" height="16" alt="[Facebook]" /></a>
<a href="http://technorati.com/faves?add=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fnix%2Fupgrading-python-on-a-dreamhost-account%2F" title="Add to my Technorati Favorites"><img src="http://technorati.com/favicon.ico" width="16" height="16" alt="[Technorati]" /></a>
<a href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fnix%2Fupgrading-python-on-a-dreamhost-account%2F&amp;title=Upgrading+Python+on+a+Dreamhost+Account" title="Save to Google Bookmarks"><img src="http://www.google.com/favicon.ico" width="16" height="16" alt="[Google]" /></a>
<a href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.reverttoconsole.com%2Fblog%2Fnix%2Fupgrading-python-on-a-dreamhost-account%2F&amp;title=Upgrading+Python+on+a+Dreamhost+Account" title="Stumble it!"><img src="http://www.stumbleupon.com/favicon.ico" width="16" height="16" alt="[StumbleUpon]" /></a>
</span>]]></content:encoded>
			<wfw:commentRss>http://www.reverttoconsole.com/blog/nix/upgrading-python-on-a-dreamhost-account/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
