put this block before the urlpatterns = patterns(*urlpatterns) statement.