<?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> &#187; django</title>
	<atom:link href="http://blog.kfirbreger.com/tag/django/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.kfirbreger.com</link>
	<description></description>
	<lastBuildDate>Tue, 24 Jan 2012 09:47:15 +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>Installing PostgreSQL and Sql-Ledger for Django apps on Snow Leopard</title>
		<link>http://blog.kfirbreger.com/2010/10/15/installing-postgresql-and-sql-ledger-for-django-apps-on-snow-leopard/</link>
		<comments>http://blog.kfirbreger.com/2010/10/15/installing-postgresql-and-sql-ledger-for-django-apps-on-snow-leopard/#comments</comments>
		<pubDate>Fri, 15 Oct 2010 19:03:09 +0000</pubDate>
		<dc:creator>Kfir</dc:creator>
				<category><![CDATA[guide]]></category>
		<category><![CDATA[work]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[it]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[sql-ledger]]></category>

		<guid isPermaLink="false">http://blog.kfirbreger.com/?p=279</guid>
		<description><![CDATA[At DOP we started working on a django front end for Sql-Ledger with the idea of combining it later on with our ticketing system. Getting it going on my MacBook proved to be more challenging then expected. Most of the problems were easily solvable, but finding the oplossing proved to be tricky. Therefor I have [...]]]></description>
			<content:encoded><![CDATA[<p>At DOP we started working on a django front end for Sql-Ledger with the idea of combining it later on with our ticketing system. Getting it going on my MacBook proved to be more challenging then expected. Most of the problems were easily solvable, but finding the oplossing proved to be tricky. Therefor I have decided to create this simple guide, showing the steps I have taken to get everything going.</p>
<p><strong>Step 1: PostgreSQL</strong></p>
<p>You can download a binary installer from the <a title="PostgreSQL download" href="http://www.postgresql.org/download/">PostgreSQL site</a>. It will install Postgre to your <code>/Library</code> folder. This should take care of the Postgre part.</p>
<p><strong>Step 2: Sql-Ledger</strong></p>
<p>Ledger is written in perl, and requires perl to run. Luckily Snow Leopard comes standard with perl. What it does not come standard with is the perl binding for PostgreSQL. The following 3 commands will take care of that:</p>
<p><code>sudo perl -MCPAN -e "install +YAML"</code><br />
YAML is not necessary but it can be helpful, and lacking YAML might give you problems with DBI.</p>
<p><code>sudo perl -MCPAN -e "install DBI"</code></p>
<p><code>sudo perl -MCPAN -e "install DBD::Pg"</code></p>
<p>This will install the perl binding for PostreSQL.</p>
<p>Download Sql-Ledger from <a href="http://www.sql-ledger.com/source/sql-ledger-2.8.31.tar.gz">here</a>. As of this writing, the latest version is 2.8.31</p>
<p>Unzip and untar the archive and follow the instructions in the readme file. I did not manage to build using the automated script and had to do everything by hand. There is also <a href="http://www.sql-ledger.org/cgi-bin/nav.pl?page=source/mac/howto-sql-ledger-osx.html">this page</a> on the ledger page with a somewhat oldish instructions for OS X.</p>
<p>Once Ledger is tested and it is working, its time to get the python binding</p>
<p><strong>Step 3: Python binding</strong></p>
<p><strong> </strong>The pyhton binding is for PostgreSQL. You can get the binding library, called Psycopg2 (don&#8217;t ask me why) from <a href="http://initd.org/psycopg/download/">here</a>. Download and upack it. Installing is done by running:<br />
<code>python setup.py build</code><br />
<code>sudo python setup.py install</code><br />
If you are not able to build it might be a problem with your path. Python is trying to link to the PostgreSQL bin files. Try to add it to your path and then to build again.</p>
<p>And your done. Enjoy (or not) working with Django-Sql-Ledger</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kfirbreger.com/2010/10/15/installing-postgresql-and-sql-ledger-for-django-apps-on-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django and static files</title>
		<link>http://blog.kfirbreger.com/2008/09/26/django-and-static-files/</link>
		<comments>http://blog.kfirbreger.com/2008/09/26/django-and-static-files/#comments</comments>
		<pubDate>Fri, 26 Sep 2008 18:18:18 +0000</pubDate>
		<dc:creator>Kfir</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://blog.kfirbreger.com/?p=90</guid>
		<description><![CDATA[After a long break I have resumed my side project in django. Last night I came upon a problem. When testing a page outside django, the page was rendered correctly. When it was rendered through django the javascript files were not located. At this point I have to admit I was a bit fullish and [...]]]></description>
			<content:encoded><![CDATA[<div>
<p>After a long break I have resumed my side project in django. Last night I came upon a problem. When testing a page outside django, the page was rendered correctly. When it was rendered through django the javascript files were not located.</p>
</div>
<div>
<p>At this point I have to admit I was a bit fullish and forgot to look at the web server&#8217;s log to see if the files were correctly served. that was an hour and a half of trying to figure out why the javascript functions were not found. So after smartening up I found out that the javascript files were not found. It seemed that django kept looking for them in the wrong location. Using the example <a href="http://docs.djangoproject.com/en/dev/howto/static-files/?from=olddocs">here</a> I eventually got it all to working.</p>
</div>
<div>
<p>It comes down to this. in the settings.py file there is a reference to the media URL and to the file system path to the media directory. Adding the following code to the urls.py<br />
<code><br />
if settings.DEBUG:<br />
urlpatterns += patterns('',<br />
(r'^tripcalc/media/(?P<br />
.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),<br />
)<br />
</code><br />
Will make sure that while django is in debug mode, serving of the static files will be done via django. for production sites it is better to let a dedicated web server (such as Apache) serve these static files.<br />
And that took care of it. I can now continue with the development. And it also enabled me to call the CSS file, so style is also shown. hurray.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.kfirbreger.com/2008/09/26/django-and-static-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Django on Dreamhost</title>
		<link>http://blog.kfirbreger.com/2008/05/19/installing-django-on-dreamhost/</link>
		<comments>http://blog.kfirbreger.com/2008/05/19/installing-django-on-dreamhost/#comments</comments>
		<pubDate>Mon, 19 May 2008 10:29:44 +0000</pubDate>
		<dc:creator>Kfir</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[dreamhost]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://blog.kfirbreger.com/?p=73</guid>
		<description><![CDATA[Dreamhost appears on the django site as one of the django friendly hosting services. Unfortunately, dreamhost does not officially support django. It does not have mod_python installed. Django is instead deployed using FastCGI. Hopefully sometime in the future mod_python will be added. There are a few good guides I have found, that explain how to [...]]]></description>
			<content:encoded><![CDATA[<p>Dreamhost appears on the django site as one of the django friendly hosting services. Unfortunately, dreamhost does not officially support django. It does not have mod_python installed. Django is instead deployed using FastCGI. Hopefully sometime in the future mod_python will be added. There are a few good guides I have found, that explain how to setup django on a dreamhost account:</p>
<li>Jeff Croft has a good guide on his <a href="http://jeffcroft.com/blog/2006/may/11/django-dreamhost/">blog</a></li>
<li>Gordon Tillman also has a good informative <a href="http://www.gordontillman.info/Development/DjangoDreamhost">page</a></li>
<li>The dreamhost wiki also has a <a href="http://wiki.dreamhost.com/index.php/Django">guide</a></li>
<p>Between the three of them you can probably find all the information needed for installing django for use on a dreamhost account. I will not repeat what they explain but instead add some from my own experience.</p>
<h2>Python</h2>
<p>Dreamhost, at the moment of writing, is running python 2.4. Luckily it is possible for you to locally install python. I highly recommend it as it will enable you to setup the python environment exactly the way you want it, and it will make it easier to upgrade to future versions of python.</p>
<p><code><br />
cd ~/soft<br />
wget http://www.python.org/ftp/python/2.5.2/Python-2.5.2.tgz<br />
tar xvfz Python-2.5.2.tgz<br />
cd Python-2.5.2<br />
./configure --prefix ~/install/dir --enable-shared<br />
make<br />
make install<br />
</code></p>
<p>Where <code>~/install/dir</code> is the directory you want python installed in. I followed dreamhost&#8217;s <a href="http://wiki.dreamhost.com/Unix_account_setup">Unix account setup guide</a> and installed it under run. I recommend you do to, as it is easier to have full control over you <code>/usr/local</code>.<br />
Also adding setuptools makes future installs easier</p>
<p><code><br />
cd ~/soft<br />
wget http://peak.telecommunity.com/dist/ez_setup.py<br />
~/path/to/yourpython/python ez_setup.py<br />
</code></p>
<p>This will add the <code>easy_install</code> script which will simplify adding packages to your own python install. The final step is adding the new MySQLdb package</p>
<p><code><br />
cd ~/soft<br />
svn co https://mysql-python.svn.sourceforge.net/svnroot/mysql-python/trunk/MySQLdb MySQLdb<br />
easy_install MySQLdb<br />
</code></p>
<p>This is assuming easy_install is in your PATH. If it is not it needs to be added.</p>
<p>Your now ready to install django using your very own Python installation. That is detailed enough so I will move to two problems I met after the installation.</p>
<h2>Post Installation Problems</h2>
<p>I met with two problems that had frustrated me for a few hours. To save you the future installer some pain here they are in case you experience something similar</p>
<p><strong>syncdb after admin activation:</strong> This should have been very obvious to me but for some reason it escaped me. After enabling the admin page you must run <code>django-admin.py syncdb</code> in your project home page. What happened was that I ran it before I enabled the admin application. This lead to the creation of the needed tables in the MySQL database, but no tables for the admin application. After enabling the admin application, more tables need to be created to accommodate the new application data. The errors I got gave me the impression that there was an error in the MySQLdb egg, so I reinstalled it, then tried to find some workaround. Eventually I realized that I&#8217;m just missing the admin tables.</p>
<p><strong>.htacess:</strong> This was the real mind bender. I kept getting an internal server error saying that it reached maximum internal allowed redirects. It was obviously a configuration error so I compared my .htaccess with that of the guides and it looked the same. So I looked else, but I kept coming back to the conclusion it has to be in the .htaccess. Yet no matter how often I looked at it I couldn&#8217;t find what was wrong. I need to point out that I am no expret when it comes to apache and that maybe if I knew more about it this would have been simple, but I didn&#8217;t so I got some gray hairs before I realized I&#8217;m missing a space between the &#8211; and the [L]. A bloody white space! I was feeling furious and incredibly stupid at the same time.</p>
<p>Django is now up and running, and I like it so far. I sure is a lot nicer to work with then with JSP and servlets. Enjoy your python</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kfirbreger.com/2008/05/19/installing-django-on-dreamhost/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

