Django 1.6 urls.defaults compatibility work-around

ImportError: No module named defaults

Getting this error on your under-maintained third party django apps? First go bug the maintainer with a pull request removing the defaults in

from django.conf.urls.defaults import *
# should be
from django.conf.urls import *

After that you can work around the issue if you don’t feel like forking the app. Just copy their urls.py file into your application then import that urls file instead.

For example let’s say you want to use django-ckeditor. Copy their urls.py file into your project. Maybe call it ckeditor_urls.py and remove “defaults”

Now in your project’s url.py change:

(r'^ckeditor/', include('ckeditor.urls')),
# change to
(r'^ckeditor/', include('mystuff.ckeditor_urls')),

Once the 3rd party app fixes their app you can just revert this change.

By David

I am a supporter of free software and run Burke Software and Consulting LLC. I am always looking for contract work especially for non-profits and open source projects. Open Source Contributions I maintain a number of Django related projects including GlitchTip, Passit, and django-report-builder. You can view my work on gitlab. Academic papers Incorporating Gaming in Software Engineering Projects: Case of RMU Monopoly in the Journal of Systemics, Cybernetics and Informatics (2008)

Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: