<?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>Daniel Hepper &#187; Django</title>
	<atom:link href="http://daniel.hepper.net/blog/category/django/feed/" rel="self" type="application/rss+xml" />
	<link>http://daniel.hepper.net/blog</link>
	<description>Random geeky stuff</description>
	<lastBuildDate>Wed, 04 Jan 2012 09:12:46 +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>Easy Django management commands with autogenerated aliases</title>
		<link>http://daniel.hepper.net/blog/2012/01/easy-django-management-commands-with-autogenerated-aliases/</link>
		<comments>http://daniel.hepper.net/blog/2012/01/easy-django-management-commands-with-autogenerated-aliases/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 08:44:59 +0000</pubDate>
		<dc:creator>Daniel Hepper</dc:creator>
				<category><![CDATA[Django]]></category>

		<guid isPermaLink="false">http://daniel.hepper.net/blog/?p=368</guid>
		<description><![CDATA[Recently, I got sick of typing django-admin.py &#60;command&#62; to run Django management commands and decided that something must be done about it. This is what I came up with: This little script creates short aliases for all available Django management &#8230; <a href="http://daniel.hepper.net/blog/2012/01/easy-django-management-commands-with-autogenerated-aliases/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Recently, I got sick of typing <code>django-admin.py &lt;command&gt;</code> to run Django management commands and decided that something must be done about it. This is what I came up with:</p>
<p><script src="https://gist.github.com/1556506.js"> </script></p>
<p>This little script creates short aliases for all available Django management commands. Typing this every time you want to work on your project obviously defeats the point, so I added it to <code>bin/activate</code> which is created by virtualenv (you do use <a href="http://www.virtualenv.org/">virtualenv</a>, don&#8217;t you?). I actually do this in a bootstrap script, using this snippet:</p>
<p><script src="https://gist.github.com/1559119.js"> </script></p>
<p>If you use <a href="http://www.doughellmann.com/docs/virtualenvwrapper/">virtualenvwrapper</a>, you can append the script to the <code>bin/postactivate</code> script instead.</p>
<p>I know there is bash completion for Django management commands. The advantage of my solution is that it is available for every developer on the project after running the bootstrap script. And it is one character less to type.</p>
<p>To run <code>django-admin.py syncdb</code>, just type <code>djsy&lt;TAB&gt;</code> instead of <code>dj&lt;TAB&gt;sy&lt;TAB&gt;</code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://daniel.hepper.net/blog/2012/01/easy-django-management-commands-with-autogenerated-aliases/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to fix VariableDoesNotExist exception in Django</title>
		<link>http://daniel.hepper.net/blog/2010/11/how-to-fix-variabledoesnotexist-exception-in-django/</link>
		<comments>http://daniel.hepper.net/blog/2010/11/how-to-fix-variabledoesnotexist-exception-in-django/#comments</comments>
		<pubDate>Wed, 10 Nov 2010 05:52:27 +0000</pubDate>
		<dc:creator>Daniel Hepper</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Howto]]></category>

		<guid isPermaLink="false">http://daniel.hepper.net/blog/?p=199</guid>
		<description><![CDATA[When Django greets you with this exception: TemplateSyntaxError at / Caught VariableDoesNotExist while rendering: Failed lookup for key [request] in... you are probably using a template tag that requires the request context processor. Simply add &#8216;django.core.context_processors.request&#8217; to the TEMPLATE_CONTEXT_PROCESSORS tuple &#8230; <a href="http://daniel.hepper.net/blog/2010/11/how-to-fix-variabledoesnotexist-exception-in-django/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When Django greets you with this exception:</p>
<p><code>TemplateSyntaxError at /</p>
<p>Caught VariableDoesNotExist while rendering: Failed lookup for key [request] in...</code></p>
<p>you are probably using a template tag that requires the <a href="http://docs.djangoproject.com/en/dev/ref/templates/api/#django-core-context-processors-request">request context processor</a>. Simply add     &#8216;django.core.context_processors.request&#8217; to the TEMPLATE_CONTEXT_PROCESSORS tuple in your settings file.</p>
]]></content:encoded>
			<wfw:commentRss>http://daniel.hepper.net/blog/2010/11/how-to-fix-variabledoesnotexist-exception-in-django/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Slides from EuroDjangoCon</title>
		<link>http://daniel.hepper.net/blog/2009/05/slides-from-the-eurodjangocon/</link>
		<comments>http://daniel.hepper.net/blog/2009/05/slides-from-the-eurodjangocon/#comments</comments>
		<pubDate>Tue, 05 May 2009 06:57:58 +0000</pubDate>
		<dc:creator>Daniel Hepper</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[eurodjangocon]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://daniel.hepper.net/blog/?p=71</guid>
		<description><![CDATA[These are the slides and code of talks given at the EuroDjangoCon, which is held in Prague from May 4th to May 6th. This information can also be found in the EuroDjangoCon Wiki. Day 1: Zed Shaw (@zedshaw): Opening Keynote &#8230; <a href="http://daniel.hepper.net/blog/2009/05/slides-from-the-eurodjangocon/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>These are the slides and code of talks given at the EuroDjangoCon, which is held in Prague from May 4th to May 6th. This information can also be found in the <a href="http://eurodjangocon.pbworks.com/Presentations">EuroDjangoCon Wiki</a>.</p>
<p><strong>Day 1:</strong></p>
<ul>
<li>Zed Shaw (<a href="http://twitter.com/zedshaw">@zedshaw</a>): <a href="http://zedshaw.com/blog/2009-05-04.html">Opening Keynote</a></li>
<li>James Tauber<span id="msgtxt1707346657" class="msgtxt en"> (<a onclick="pageTracker._trackPageview('/exit/to/jtauber')" href="http://twitter.com/jtauber" target="_blank">@jtauber</a></span>): <a href="http://eldarion.com/talks/2009/05/eurodjangocon_djangopatterns.pdf">Django Patterns [PDF]</a></li>
<li>Andrew Godwin (<a href="http://twitter.com/andrewgodwin">@andrewgodwin)</a>: <a href="http://www.aeracode.org/static/edc09slides.pdf">Migrations: whywhyhowwho?</a></li>
<li>Paul Smith (<a onclick="pageTracker._trackPageview('/exit/to/paulsmith');" href="http://twitter.com/paulsmith" target="_blank">@paulsmith</a>): <a href="http://www.slideshare.net/pauladamsmith/the-web-map-stack-on-django">The web map stack on Django</a></li>
<li>Justin Lilly (<span id="msgtxt1695888991" class="msgtxt en"><a onclick="pageTracker._trackPageview('/exit/to/justinlilly')" href="http://twitter.com/justinlilly" target="_blank">@justinlilly</a>)</span>: <a href="http://justinlilly.com/blog/2009/may/04/eurodjangocon-django-30000-feet/">Django @ 30.000 feet</a></li>
<li>Simon Willison (<span id="msgtxt1705398406" class="msgtxt en"><a onclick="pageTracker._trackPageview('/exit/to/simonw')" href="http://twitter.com/simonw" target="_blank">@simonw</a></span>): <a href="http://www.slideshare.net/simon/django-heresies">Django Heresies</a></li>
</ul>
<p><strong>Day 2:</strong></p>
<ul>
<li>Honza Kral (<a href="http://twitter.com/HonzaKral">@HonzaKral</a>): <a href="http://honzakral.com/validation.pdf ">Model Aware Validation</a></li>
<li>Mike Malone (<span id="msgtxt1705781738" class="msgtxt en"><a onclick="pageTracker._trackPageview('/exit/to/mjmalone')" href="http://twitter.com/mjmalone" target="_blank">@mjmalone</a>)</span>: <a href="http://immike.net/files/scaling_django.pdf">Scaling Django Web Apps [PDF]</a> + <a href="http://github.com/mmalone">Code on Github<br />
</a></li>
<li>Eric Holscher (<span id="msgtxt1707626602" class="msgtxt en"><a onclick="pageTracker._trackPageview('/exit/to/ericholscher')" href="http://twitter.com/ericholscher" target="_blank">@ericholscher</a>)</span>: <a href="http://www.slideshare.net/ericholscher/testing-slides-1387499">Django Testing</a></li>
<li>Peter Baumgartner, Michael Trythall (<a onclick="pageTracker._trackPageview('/exit/to/LincolnLoop');" href="http://twitter.com/LincolnLoop" target="_blank">@LincolnLoop</a>): <a href="http://lincolnloop.com/assets/Customizing_the_Django_Admin-EuroDjangoCon09.pdf">Customizing the Django Admin [PDF]</a></li>
<li>Alex Gaynor (<a onclick="pageTracker._trackPageview('/exit/to/alex_gaynor')" href="http://twitter.com/alex_gaynor" target="_blank">@alex_gaynor</a>): <a href="http://www.slideshare.net/kingkilr/forms-getting-your-moneys-worth">Forms, Getting Your Money&#8217;s Worth</a></li>
<li>Joe Stump (<a href="http://twitter.com/joestump">@joestump</a>) <a href="http://eurodjangocon.pbworks.com/f/Rethinking_the_Stack.key.zip">Rethinking the Stack</a></li>
</ul>
<p><strong>Day 3:</strong></p>
<ul style="text-align: left;">
<li>Franz Wierzbicki (<a href="http://twitter.com/fwierzbicki">@fwierzbicki</a>): <a href="http://www.slideshare.net/fwierzbicki/jython-on-django">Django on Jython</a></li>
<li>David Larlet (<a href="http://twitter.com/davidbgk">@davidbgk</a>): State of the art and future of Semantic stuff in Django (panel)</li>
<li>Leah Culver (<a href="http://twitter.com/leahculver">@leahculver</a>): The Next Big Thing</li>
<li>James Tauber <span id="msgtxt1707346657" class="msgtxt en"> (<a onclick="pageTracker._trackPageview('/exit/to/jtauber')" href="http://twitter.com/jtauber" target="_blank">@jtauber</a></span>): <a href="http://bit.ly/18bumK">State of Pinax</a></li>
<li>Joe Stump (<a href="http://twitter.com/joestump">@joestump</a>): Working with large data sets</li>
<li>Andy Smith (<a href="http://twitter.com/termie">@termie</a>): <a href="http://term.ie/data/MigratingFromLampToAppEngine.pdf">Migrating from LAMP to App Engine</a></li>
</ul>
<p>Other:</p>
<ul>
<li><a href="http://www.flickr.com/photos/dibau_naum_h/tags/eurodjangocon/">Mindmap summaries</a> by <a href="http://twitter.com/dibau_naum_h">@dibau_naum_h</a></li>
<li><a href="http://eurodjangocon.pbworks.com/Lightning-Talks">Lightning talks</a></li>
</ul>
<p>This post will be updated over time. Please leave a comment if you think something is missing.</p>
]]></content:encoded>
			<wfw:commentRss>http://daniel.hepper.net/blog/2009/05/slides-from-the-eurodjangocon/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Building a site with Django? Start with Pinax!</title>
		<link>http://daniel.hepper.net/blog/2008/11/building-a-site-with-django-start-with-pinax/</link>
		<comments>http://daniel.hepper.net/blog/2008/11/building-a-site-with-django-start-with-pinax/#comments</comments>
		<pubDate>Tue, 04 Nov 2008 14:29:38 +0000</pubDate>
		<dc:creator>Daniel Hepper</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://daniel.hepper.net/blog/?p=22</guid>
		<description><![CDATA[Some time ago, I watched James Tauber&#8217;s talk at DjangoCon about Pinax, a collection of re-usable Django applications. If you are thinking of a collection as a bunch of apps carelessly thrown together, you could not be more mistaken. Pinax &#8230; <a href="http://daniel.hepper.net/blog/2008/11/building-a-site-with-django-start-with-pinax/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Some time ago, I watched James Tauber&#8217;s talk at DjangoCon about <a title="Pinax, a platform for rapidly developing websites" href="http://pinaxproject.com/">Pinax</a>, a collection of re-usable Django applications. If you are thinking of a collection as a bunch of apps carelessly thrown together, you could not be more mistaken. Pinax is the foundation for a complete social networking site which covers most features you can imagine, the whole nine yards.</p>
<p>Forget <code>django-admin.py startproject</code>! Just do <code>cp pinax myproject</code>, remove some stuff you don&#8217;t need, adjust the templates and you are done!</p>
<p>Ok, I might be exagerating a bit, but watch the talk to build your own opinion.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="src" value="http://www.youtube.com/v/1J91Ownq-7g&amp;hl=en&amp;fs=1" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/1J91Ownq-7g&amp;hl=en&amp;fs=1" allowfullscreen="true"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://daniel.hepper.net/blog/2008/11/building-a-site-with-django-start-with-pinax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dynamic paths for lazy people</title>
		<link>http://daniel.hepper.net/blog/2008/09/dynamic-paths-for-lazy-people/</link>
		<comments>http://daniel.hepper.net/blog/2008/09/dynamic-paths-for-lazy-people/#comments</comments>
		<pubDate>Wed, 24 Sep 2008 09:13:21 +0000</pubDate>
		<dc:creator>Daniel Hepper</dc:creator>
				<category><![CDATA[Django]]></category>

		<guid isPermaLink="false">http://daniel.hepper.net/blog/?p=13</guid>
		<description><![CDATA[Once your Django project has to run on multiple machines, the absolute paths in settings.py will drive you nuts. A suggested solution to enhance portability (in German) is to define a PROJECT_ROOT. import os PROJECT_ROOT = os.path.dirname&#40;__file__&#41; And then define &#8230; <a href="http://daniel.hepper.net/blog/2008/09/dynamic-paths-for-lazy-people/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Once your Django project has to run on multiple machines, the absolute paths in <code>settings.py</code> will drive you nuts.</p>
<p><a href="http://www.mahner.org/weblog/wiederverwendbare-django-projekte/">A suggested solution to enhance portability</a> (in German) is to define a <code>PROJECT_ROOT</code>.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>
PROJECT_ROOT = <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">dirname</span><span style="color: black;">&#40;</span>__file__<span style="color: black;">&#41;</span></pre></div></div>

<p>And then define absolute paths like this:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">MEDIA_ROOT = <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>PROJECT_ROOT, <span style="color: #483d8b;">'site_media'</span><span style="color: black;">&#41;</span>
TEMPLATE_DIRS = <span style="color: black;">&#40;</span>
    <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>PROJECT_ROOT, <span style="color: #483d8b;">'templates'</span><span style="color: black;">&#41;</span>,
<span style="color: black;">&#41;</span></pre></div></div>

<p>The downside is, typing <code>os.path.join(PROJECT_ROOT,'foo')</code> <del>twice</del> over and over again, will probably incur the wrath of the DRY gods. But don&#8217;t despair, we can do better:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>
PROJECT_ROOT = <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">dirname</span><span style="color: black;">&#40;</span>__file__<span style="color: black;">&#41;</span>
p = <span style="color: #ff7700;font-weight:bold;">lambda</span> <span style="color: #66cc66;">*</span>x: <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>PROJECT_ROOT,<span style="color: #66cc66;">*</span>x<span style="color: black;">&#41;</span></pre></div></div>

<p>Use it like this:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">MEDIA_ROOT = p<span style="color: black;">&#40;</span><span style="color: #483d8b;">'static'</span><span style="color: black;">&#41;</span>
TEMPLATE_DIRS = <span style="color: black;">&#40;</span>
    p<span style="color: black;">&#40;</span><span style="color: #483d8b;">'templates'</span><span style="color: black;">&#41;</span>,
<span style="color: black;">&#41;</span>
MY_NESTED_PATH = p<span style="color: black;">&#40;</span><span style="color: #483d8b;">'x'</span>,<span style="color: #483d8b;">'y'</span><span style="color: black;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://daniel.hepper.net/blog/2008/09/dynamic-paths-for-lazy-people/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Pitfalls in Django unittests</title>
		<link>http://daniel.hepper.net/blog/2008/09/pitfalls-in-django-unittests/</link>
		<comments>http://daniel.hepper.net/blog/2008/09/pitfalls-in-django-unittests/#comments</comments>
		<pubDate>Sat, 13 Sep 2008 13:10:32 +0000</pubDate>
		<dc:creator>Daniel Hepper</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://daniel.hepper.net/blog/?p=9</guid>
		<description><![CDATA[I&#8217;m currently rewriting dwidder and I just spent way to much time on a unit test for the registration view. These are the things that made me stumble: Write fixtures. Unit tests run on an empty database. Somewhere deep in &#8230; <a href="http://daniel.hepper.net/blog/2008/09/pitfalls-in-django-unittests/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently rewriting <a title="German SMS-Twitter-Gateway" href="http://dwidder.de">dwidder</a> and I just spent way to much time on a unit test for the registration view. These are the things that made me stumble:</p>
<ol>
<li><strong>Write fixtures</strong>. Unit tests run on an empty database. Somewhere deep in your code might be a reference to one of the default applications, like django.contrib.sites, which will fail, because there is no default site object in your database.</li>
<li><strong>Don&#8217;t subclass unittest.TestCase</strong>. Use Django&#8217;s TestCase class instead. Otherwise you will miss all the fancy stuff, like automatic fixture loading.</li>
<li><strong>Import mail, not outbox.</strong> Django provides a dummy email outbox. But it to make it work as expected, you have to import the mail module. If you import the outbox directly, it will always be empty.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://daniel.hepper.net/blog/2008/09/pitfalls-in-django-unittests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

