Blog Archive for November 21, 2009

Turn off Redirect Intercept on Django Debug Toolbar

November 21, 2009

To turn off the intercepting of each redirect when using the Django Debug Toolbar, add the following to settings.py:

DEBUG_TOOLBAR_CONFIG = {
    'INTERCEPT_REDIRECTS': False,
}

Setting up Pygments with Markdown

November 21, 2009

There's some confusion out there about how to set up Pygments with Markdown. The Pygments website suggests that you add a text preprocessor, but it's simpler than that.

This code takes a markdown formatted file and converts it to HTML formatted text including pygments based source code. When formatting code …

Apache mod_wsgi config

November 21, 2009

mod_wsgi is now the recommended method for deploying your django sites. This shows how to set up a django site using mod_wsgi on apache, and have the site auto-reload when the source files change.

Here's what you need:

site-wsgi.py

import os, sys
sys.path.append('/path/to/deploy/directory' …

Django Contrib Comments

November 21, 2009

Django has build in support for adding comments to model objects.

models.py

Add the following field to the model you want to add comments to

enable_comments = models.BooleanField(default=True)

This gives you a way of turning off comments for particular models.

urls.py

Add the …