<?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>Christopher Lawlor &#187; Django</title>
	<atom:link href="http://blog.christopherlawlor.com/category/django/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.christopherlawlor.com</link>
	<description>Adventures in Freelancing</description>
	<lastBuildDate>Thu, 18 Aug 2011 13:12:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Hiding the Django Debug Toolbar in the Admin</title>
		<link>http://blog.christopherlawlor.com/2011/08/hiding-the-django-debug-toolbar-in-the-admin/</link>
		<comments>http://blog.christopherlawlor.com/2011/08/hiding-the-django-debug-toolbar-in-the-admin/#comments</comments>
		<pubDate>Thu, 18 Aug 2011 13:10:18 +0000</pubDate>
		<dc:creator>clawlor</dc:creator>
				<category><![CDATA[Dev Tools]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[dev-tools]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://blog.christopherlawlor.com/?p=60</guid>
		<description><![CDATA[The Django Debug Toolbar is a an extremely helpful tool, but I find it a bit annoying in the admin. Thankfully, it only takes a few lines of code to blacklist the admin section. Put this in your local_settings file (click the little &#8216;View Source&#8217; icon in the upper right to easily cut &#038; paste):]]></description>
			<content:encoded><![CDATA[<p>The Django Debug Toolbar is a an extremely helpful tool, but I find it a bit annoying in the admin. Thankfully, it only takes a few lines of code to blacklist the admin section.</p>
<p>Put this in your local_settings file (click the little &#8216;View Source&#8217; icon in the upper right to easily cut &#038; paste):</p>
<pre class="brush: python">
import re
def show_toolbar(request):
    uri = request.get_full_path()
    if re.match(r&#039;/admin/&#039;, uri):
        return False
    return True

DEBUG_TOOLBAR_CONFIG = {
    &#039;SHOW_TOOLBAR_CALLBACK&#039;: show_toolbar
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.christopherlawlor.com/2011/08/hiding-the-django-debug-toolbar-in-the-admin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django How-To: Add Debugging Apps to Your Local Settings</title>
		<link>http://blog.christopherlawlor.com/2010/06/django-how-to-add-debugging-apps-to-your-local-settings/</link>
		<comments>http://blog.christopherlawlor.com/2010/06/django-how-to-add-debugging-apps-to-your-local-settings/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 14:16:07 +0000</pubDate>
		<dc:creator>clawlor</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[settings]]></category>

		<guid isPermaLink="false">http://blog.christopherlawlor.com/?p=41</guid>
		<description><![CDATA[There are some great debugging apps, like the django-debug-toolbar and django-command-extensions, that help out immensely while developing your next killer Django site. There&#8217;s a small catch to using them though, which is that they have to be added to INSTALLED_APPS. No big deal, but you don&#8217;t really want these installed and running in a production]]></description>
			<content:encoded><![CDATA[<p>There are some great debugging apps, like the <a href="http://github.com/robhudson/django-debug-toolbar">django-debug-toolbar</a> and <a href="http://code.google.com/p/django-command-extensions/">django-command-extensions</a>, that help out immensely while developing your next killer Django site. There&#8217;s a small catch to using them though, which is that they have to be added to <code>INSTALLED_APPS</code>. No big deal, but you don&#8217;t really want these installed and running in a production install.</p>
<p>Again, no big deal. It&#8217;s an old trick now to <a href="http://djangosnippets.org/snippets/644/">maintain a separate <code>local_settings.py</code> file</a>. By importing our <code>local_settings</code> at the end of the <code>settings.py</code> module, anything in <code>local_settings</code> will overwrite whatever is in <code>settings</code>.</p>
<p>So all we have to do then is make a new list of debugging apps in <code>local_settings.py</code>, and add them to the <code>INSTALLED_APPS</code> list in <code>settings.py</code>.</p>
<p>My first naive attempt was to do this:</p>
<pre class="brush: python">
# local_settings.py
INSTALLED_APPS +=  (&#039;django_extensions&#039;,)
</pre>
<p>Can you spot the problem? The original <code>INSTALLED_APPS</code> is not available in <code>local_settings.py</code>, so we can&#8217;t add to it there.</p>
<p>Well, if we can&#8217;t add our list in <code>local_settings.py</code>, let&#8217;s add in in settings.py</p>
<pre class="brush: python">
# local_settings.py
DEBUG_APPS = (&#039;django_extensions&#039;,)

# settings.py
try:
    from local_settings.py import *
    INSTALLED_APPS += DEBUG_APPS
except ImportError:
    pass
</pre>
<p>This works just fine, as long as there is a <code>DEBUG_APPS</code> list specified in <code>local_settings.py</code>. However, the whole point of having a <code>local_settings.py</code> file is to <strong>optionally</strong> add or overwrite settings.</p>
<p>To remove this dependency, simply define an empty <code>DEBUG_APPS</code> setting in the main <code>settings.py</code> file.</p>
<p>Our end result looks like:</p>
<pre class="brush: python">
# local_settings.py
DEBUG_APPS = (&#039;django_extensions&#039;,)

# settings.py
DEBUG_APPS = None
try:
    from local_settings.py import *
    INSTALLED_APPS += DEBUG_APPS
except ImportError:
    pass
</pre>
<p>Another nice trick, if you&#8217;re using pip, is to set up a separate requirements file for your debugging apps. For example, a requirements file for django_extensions:</p>
<pre class="brush: html">
# debug_requirements.txt
django-extensions==0.5
Werkzeug==0.6.2
</pre>
<p>Then to install my debugging apps, I just run <code>pip install -r debug_requirements.txt</code></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.christopherlawlor.com/2010/06/django-how-to-add-debugging-apps-to-your-local-settings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  blog.christopherlawlor.com/category/django/feed/ ) in 1.50639 seconds, on Feb 6th, 2012 at 5:20 am UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 6th, 2012 at 6:20 am UTC -->
