Python – Django import error – no module named django.conf.urls.defaults

djangodjango-1.6graphitepython

I am trying to run statsd/graphite which uses django 1.6.

While accessing graphite URL, I get django module error

File "/opt/graphite/webapp/graphite/urls.py", line 15, in
from django.conf.urls.defaults import *
ImportError: No module named defaults

However, I do not find defaults django package inside /Library/Python/2.7/site-packages/django/conf/urls/

Please help fixing this issue.

Best Answer

django.conf.urls.defaults has been removed in Django 1.6. If the problem was in your own code, you would fix it by changing the import to

from django.conf.urls import patterns, url, include

However, in your case the problem is in a third party app, graphite. The issue has been fixed in graphite's master branch and version 0.9.14+.

In Django 1.8+ you can remove patterns from the import, and use a list of url()s instead.

from django.conf.urls import url, include
Related Topic