<?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>MangoOrange™ &#187; Python</title>
	<atom:link href="http://www.mangoorange.com/tag/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mangoorange.com</link>
	<description>Web Hosting Reviews &#38; Mac WordPress Theme</description>
	<lastBuildDate>Wed, 25 Jan 2012 18:31:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Sexy way of setting Django in Webfaction</title>
		<link>http://www.mangoorange.com/2008/09/25/sexy-way-of-setting-django-in-webfaction/</link>
		<comments>http://www.mangoorange.com/2008/09/25/sexy-way-of-setting-django-in-webfaction/#comments</comments>
		<pubDate>Fri, 26 Sep 2008 07:31:20 +0000</pubDate>
		<dc:creator>mangoorange</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[conf]]></category>
		<category><![CDATA[httpd]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[static files]]></category>
		<category><![CDATA[webfaction]]></category>

		<guid isPermaLink="false">http://www.mangoorange.com/?p=195</guid>
		<description><![CDATA[Last week, I signed up an account with Webfaction, for my latest Django (sounds like Jungle) adventure. So far, it's one of the few web hosting companies out there that offer support for Django framework and they did a superb job at it. I love them. A few days back, I wrote my first Django [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" style="float: right;" src="http://www.webfaction.com/chrome/webfaction_logo.png" alt="Webfaction logo" width="252" height="58" />Last week, I signed up an account with <a title="Webfaction Hosting" href="http://www.webfaction.com?affiliate=mickeyckm" target="_blank">Webfaction</a>, for my latest <a title="Django framework" href="http://www.djangoproject.com" target="_blank">Django</a> (sounds like Jungle) adventure. So far, it's one of the few <a href="http://www.alreadyhosting.com">web hosting companies</a> out there that offer support for Django framework and they did a superb job at it. I love them.</p>
<p>A few days back, I wrote my first Django app, <a title="Tweeeter" href="http://tweeeter.mangodjango.com/" target="_blank">Tweeeter</a>, after following a few tutorials. With the app, I think it will be great to get it deployed to have a full experience from programming to deployment. So I followed the <a title="Getting started with Django at WebFaction" href="https://help.webfaction.com/122" target="_blank">tutorial</a> from Webfaction's knowledgebase.</p>
<p>However, I felt the approach has messed up the normal structure that I usually used, which is having <strong>apps folder</strong> and <strong>includes folder</strong> in the <strong>django project folder</strong>. The tutorial shows how to server static files by creating Webfaction's app. So if you have 10 static folders, you will have to create 10 Webfaction's app, which I can't understand why I must do it. So, after hours of trying, with the help of Webfaction's support, it finally works the way I wanted.</p>
<p>So how do I setup my own django app in Webfaction?</p>
<p>I followed exactly what the tutorial said except the part of setting up the static files. Instead of creating multiple apps, I just add the following to the <strong>apache/httpd.conf</strong> in the djangoproject.</p>
<pre>Alias /includes/ /home/username/webapps/webfactionapp/djangoproject/includes/
&nbsp;
    SetHandler None</pre>
<pre>Alias /media/ /home/username/webapps/webfactionapp/lib/python2.5/django/contrib/admin/media/
&nbsp;
    SetHandler None</pre>
<p>I hope it's clear enough. If there is any questions, feel free leave it in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mangoorange.com/2008/09/25/sexy-way-of-setting-django-in-webfaction/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>FakeTwitter</title>
		<link>http://www.mangoorange.com/2008/09/18/faketwitter/</link>
		<comments>http://www.mangoorange.com/2008/09/18/faketwitter/#comments</comments>
		<pubDate>Thu, 18 Sep 2008 09:15:12 +0000</pubDate>
		<dc:creator>mangoorange</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.mangoorange.com/?p=191</guid>
		<description><![CDATA[I'm so proud of myself. I finally put together my very own, first Django project, FakeTwitter. I just created a simple wall to post with a timestamp. Simple stuff, but I have a wonderful time doing it. Here's the screenshot of FakeTwitter.]]></description>
			<content:encoded><![CDATA[<p>I'm so proud of myself. I finally put together my very own, first Django project, FakeTwitter. I just created a simple wall to post with a timestamp. Simple stuff, but I have a wonderful time doing it.</p>
<p>Here's the screenshot of FakeTwitter.</p>
<p><a href="http://www.mangoorange.com/wp-content/uploads/2008/09/picture-2.png"><img title="FakeTwitter" src="http://www.mangoorange.com/wp-content/uploads/2008/09/picture-2.png" alt="The fake version of Twitter" width="453" height="290" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mangoorange.com/2008/09/18/faketwitter/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>django-registration tutorial</title>
		<link>http://www.mangoorange.com/2008/09/17/django-registration-tutorial/</link>
		<comments>http://www.mangoorange.com/2008/09/17/django-registration-tutorial/#comments</comments>
		<pubDate>Thu, 18 Sep 2008 01:05:31 +0000</pubDate>
		<dc:creator>mangoorange</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[django-registration]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.mangoorange.com/?p=190</guid>
		<description><![CDATA[Django has been my thing for the past few weeks. It's been a lot of fun reading the James Bennett's Practical Django Projects. Unfortunately, on Sept 3, the release of Django v1.0 has made many of the codes not compatible. The new release of Django has given me a headache while I was trying to [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" style="float: right;" src="http://ecx.images-amazon.com/images/I/51sBJoCpzHL.jpg" alt="Practical Django Projects" width="160" height="212" /><a title="Django Project" href="http://www.djangoproject.com" target="_blank">Django</a> has been my thing for the past few weeks. It's been a lot of fun reading the James Bennett's <a title="Practical Django Projects" href="http://www.amazon.com/Practical-Django-Projects-Pratical/dp/1590599969/ref=pd_bbs_sr_1?ie=UTF8&amp;s=books&amp;qid=1221682241&amp;sr=8-1" target="_blank">Practical Django Projects</a>. Unfortunately, on Sept 3, the release of Django v1.0 has made many of the codes not compatible.</p>
<p>The new release of Django has given me a headache while I was trying to setup <a title="django-registration googlecode" href="http://www.google.com/url?sa=t&amp;source=web&amp;ct=res&amp;cd=1&amp;url=http%3A%2F%2Fcode.google.com%2Fp%2Fdjango-registration%2F&amp;ei=qWXRSIetJoKMsAOe7ZyJBw&amp;usg=AFQjCNETsgzo4kHEbOHQxmn012kzVQHTFw&amp;sig2=LyJAIAQyVS8tJB3HHtyW3g" target="_blank">django-registration</a>. The problem lies in the upgrading of Django to the latest build. The old Django codes cause a problem in setting the app. Thanks to the guys at the Django Channel that helped me out.</p>
<p>So I hope I can help by writing a tutorial for those who needs it. <a title="StoneMind Django-Registration tutorial" href="http://www.google.com/url?sa=t&amp;source=web&amp;ct=res&amp;cd=3&amp;url=http%3A%2F%2Fwww.stonemind.net%2Fblog%2F2007%2F04%2F13%2Fdjango-registration-for-newbies%2F&amp;ei=qWXRSIetJoKMsAOe7ZyJBw&amp;usg=AFQjCNEDJTspoFwm_2jVAO9PoRaGk_DK_Q&amp;sig2=vDNQ7IwksJj96tqXdMoc0w" target="_blank">Stone Mind</a>, once wrote a tutorial on django-registration, but it's out-dated now.</p>
<p>Here it goes:</p>
<p><strong>Prerequisites:</strong><br />
django version 1.0<br />
django-registration version 0.6 (if possible, use the <a title="django-registration" href="http://django-registration.googlecode.com/svn/trunk/" target="_blank">trunk</a> copy)</p>
<p><strong>Step 1, unpack django-registration:</strong><br />
Put the app folder, <em>registration</em> into the project folder. (make sure that your PYTHONPATH is pointing to the project folder). <em>registration</em> folder is the folder that contains __init__.py.</p>
<p><strong>Step 2, setup the application:<br />
</strong>Add 'registration' into the list of INSTALLED_APPS. For example,</p>
<pre class="python">INSTALLED_APPS = <span style="color: black;">&#40;</span>
    <span style="color: #483d8b;">'django.contrib.auth'</span>,
    <span style="color: #483d8b;">'django.contrib.contenttypes'</span>,
    <span style="color: #483d8b;">'django.contrib.sessions'</span>,
    <span style="color: #483d8b;">'django.contrib.sites'</span>,
    <span style="color: #483d8b;">'django.contrib.admin'</span>,
    <span style="color: #483d8b;">'registration'</span>,
<span style="color: black;">&#41;</span></pre>
<p><strong>Step 3, setup the database</strong>:<br />
Run <code>python manage.py syncdb</code> to populate the tables from the list of applications. Ensure you have filled in the relevant database settings before you run it. Example for sqlite3 database settings,</p>
<pre class="python">DATABASE_ENGINE = <span style="color: #483d8b;">'sqlite3'</span>
DATABASE_NAME = <span style="color: #483d8b;">'reg.db'</span>
DATABASE_USER = <span style="color: #483d8b;">''</span>
DATABASE_PASSWORD = <span style="color: #483d8b;">''</span>
DATABASE_HOST = <span style="color: #483d8b;">''</span>
DATABASE_PORT = <span style="color: #483d8b;">''</span></pre>
<p><strong>Step 4, setup the url pointer:</strong><br />
Add <code>(r'accounts/', include('registration.urls'))</code> into the list of URLpatterns. For example,</p>
<pre class="python">urlpatterns = patterns<span style="color: black;">&#40;</span><span style="color: #483d8b;">''</span>,
    <span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'^admin/(.*)'</span>, admin.<span style="color: #dc143c;">site</span>.<span style="color: black;">root</span><span style="color: black;">&#41;</span>,
    <span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'^accounts/'</span>, include<span style="color: black;">&#40;</span><span style="color: #483d8b;">'registration.urls'</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
<span style="color: black;">&#41;</span></pre>
<p><strong>Step 5, setup the templates:</strong><br />
Setup the template path by adding /path/to/project/templates/ in TEMPLATE_DIRS. Example,</p>
<pre class="python">TEMPLATE_DIRS = <span style="color: black;">&#40;</span>
   <span style="color: #483d8b;">'/Users/mangoorange/Projects/Django/reg/templates/'</span>
<span style="color: black;">&#41;</span></pre>
<p><strong>Step 6, inserting the templates:<br />
</strong>This part is actually fairly simple. I have provided a copy of a working project, [download#74#nohits], that you can use. Just add in the django-registration app into the project folder. If you want to learn more about template form, you can check it out <a title="Django Project Forms" href="http://docs.djangoproject.com/en/dev/topics/forms/#topics-forms-index" target="_blank">here</a>.</p>
<p><strong>Step 7, done:</strong><br />
Sorry to disappoint you. It's done. <img src='http://www.mangoorange.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Feel free to share any feedback and comments on the tutorial. Hope it helps.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mangoorange.com/2008/09/17/django-registration-tutorial/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>DjangoCon 2008 videos are out!!!</title>
		<link>http://www.mangoorange.com/2008/09/15/djangocon-2008-videos-are-out/</link>
		<comments>http://www.mangoorange.com/2008/09/15/djangocon-2008-videos-are-out/#comments</comments>
		<pubDate>Tue, 16 Sep 2008 01:41:47 +0000</pubDate>
		<dc:creator>mangoorange</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[djangocon]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.mangoorange.com/?p=185</guid>
		<description><![CDATA[It's a week since the first Django conference ended. Sigh, I didn't manage to get the ticket. Anyway, for those who missed it, like me, the videos are out. I can't wait to go through all of it. The link below: http://www.youtube.com/view_play_list?p=D415FAF806EC47A1 Share with me your favorites.]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" style="float: right;" src="http://djangocon.org/site_media/images/djangocon-logo.png" alt="DjangoCon 2008" width="231" height="79" />It's a week since the first Django conference ended. Sigh, I didn't manage to get the ticket. Anyway, for those who missed it, like me, the videos are out. I can't wait to go through all of it.</p>
<p>The link below:<br />
<a title="DjangoCon 2008 videos" href="http://www.youtube.com/view_play_list?p=D415FAF806EC47A1" target="_blank">http://www.youtube.com/view_play_list?p=D415FAF806EC47A1</a></p>
<p>Share with me your favorites. <img src='http://www.mangoorange.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.mangoorange.com/2008/09/15/djangocon-2008-videos-are-out/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Python MySQLdb 1.2.2 on Mac OS X</title>
		<link>http://www.mangoorange.com/2008/08/01/installing-python-mysqldb-122-on-mac-os-x/</link>
		<comments>http://www.mangoorange.com/2008/08/01/installing-python-mysqldb-122-on-mac-os-x/#comments</comments>
		<pubDate>Fri, 01 Aug 2008 16:59:37 +0000</pubDate>
		<dc:creator>mangoorange</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[1.2.2]]></category>
		<category><![CDATA[mac osx]]></category>
		<category><![CDATA[mysqldb]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.mangoorange.com/?p=182</guid>
		<description><![CDATA[I started working on Python start of the year and I learned a lot while I'm doing my internship in my current company, MooWee Inc. So it's logical for me to try to pick up Django as the web framework. One of the hurdle I met and everyone else met is trying to install MySQL [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" style="float: right;" src="http://farm2.static.flickr.com/1319/1129819772_77804dda7f.jpg" alt="Python" width="253" height="85" />I started working on <a title="Python" href="http://www.python.org" target="_blank">Python</a> start of the year and I learned a lot while I'm doing my internship in my current company, <a title="Moowee, Inc" href="http://moowee.tv/" target="_blank">MooWee Inc</a>. So it's logical for me to try to pick up <a title="Django Project" href="http://djangoproject.org" target="_blank">Django</a> as the web framework.</p>
<p>One of the hurdle I met and everyone else met is trying to install <a title="MySQL" href="http://www.mysql.org" target="_blank">MySQL</a> adapter for Python. Being the most popular database used, it is crucial to have it work rather than circumventing around the problem by using alternative database such as <a title="SQLite" href="http://www.sqlite.org" target="_blank">SQLite</a> or <a title="PostgreSQL" href="http://www.postgresql.org/" target="_blank">PostgreSQL</a>.</p>
<p>After a few hours of searching, I found a few references that somewhat not entirely complete. I did some cross referencing and found two brings me to the entire solutions, which I'm about to show below.</p>
<p><span id="more-182"></span></p>
<p><span style="text-decoration: underline;"><strong>Step 0:<br />
</strong></span>Before I start, I assumed that you have <a title="MySQL" href="http://mysql.org" target="_blank">MySQL</a> and <a title="Python" href="http://www.python.org" target="_blank">Python</a> installed on the mac.</p>
<p><span style="text-decoration: underline;"><strong>Step 1:</strong></span><br />
Download the latest <a title="MySQL for Python" href="http://sourceforge.net/project/showfiles.php?group_id=22307" target="_blank">MySQL for Python</a> adapter from SourceForge.</p>
<p><span style="text-decoration: underline;"><strong>Step 2:</strong></span><br />
Extract your downloaded package by typing</p>
<p><code>$ tar xzvf MySQL-python-1.2.2.tar.gz</code></p>
<p><strong><span style="text-decoration: underline;">Step 3:<br />
</span></strong>Inside the folder, clean the package by typing</p>
<p><code>$ sudo python setup.py clean</code></p>
<p><span style="text-decoration: underline;"><strong>Step 4:</strong></span><br />
In the same folder, edit _mysql.c using your favourite text-editor</p>
<p>4a. Remove the following lines (37-39):</p>
<p><code>#ifndef uint<br />
#define uint unsigned int<br />
#endif</code></p>
<p>4b. Change the following:</p>
<p><code>uint port = MYSQL_PORT;<br />
uint client_flag = 0;</code></p>
<p>to</p>
<p><code>unsigned int port = MYSQL_PORT;<br />
unsigned int client_flag = 0;</code></p>
<p><span style="text-decoration: underline;"><strong>Step 5:</strong></span><br />
Create a symbolic link under lib to point to a sub-directory called mysql. This is where it looks for during compilation.</p>
<p><code>$ sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql</code></p>
<p><span style="text-decoration: underline;"><strong>Step 6:</strong></span><br />
Edit the setup_posix.py and change the following</p>
<p><code>mysql_config.path = "mysql_config"</code></p>
<p>to</p>
<p><code>mysql_config.path = "/usr/local/mysql/bin/mysql_config"</code></p>
<p><span style="text-decoration: underline;"><strong>Step 7:</strong></span><br />
In the same directory, rebuild your package (ignore the warnings that comes with it)</p>
<p><code>$ sudo python setup.py build</code></p>
<p><span style="text-decoration: underline;"><strong>Step 8:</strong></span><br />
Install the package and you are done.</p>
<p><code>$ sudo python setup.py install</code></p>
<p><span style="text-decoration: underline;"><strong>Step 9:</strong></span><br />
Test if it's working. It works if you can import MySQLdb.</p>
<p><code>$ python<br />
&gt;&gt;&gt; import MySQLdb</code></p>
<p>Voila.</p>
<p><span style="text-decoration: underline;"><strong>References:</strong></span><br />
<a title="n.code" href="http://dotnet.org.za/ncode/archive/2007/01/31/setting-up-mysql-for-python-mysqldb-on-mac-os-x-2.aspx" target="_blank">n.code</a><br />
<a title="Red Elephant" href="http://www.keningle.com/?p=11" target="_blank">RedElephant</a><br />
<a title="Django users Google Groups" href="http://groups.google.com/group/django-users/browse_thread/thread/b3e125adaf6e8356" target="_blank">Django users Google Groups</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mangoorange.com/2008/08/01/installing-python-mysqldb-122-on-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
	</channel>
</rss>

