Robert
Robert

Reputation: 2249

ImportError at /admin: No module named defaults

I am upgrading my site from django 1.4 to django 1.6, and it kept came out with this error: ImportError at /admin: No module named defaults. Everywhere else say you should do:

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

But I didn't find "from django.conf.urls.defaults import *" from anywhere in my code. The debugger indicates that the exception location is:

Exception Location: /home/.../webapps/healthtweets_dev/lib/python2.7/django/utils/importlib.py in import_module, line 40

And it highlighted the admin.autodiscover() in the traceback:

/home/.../webapps/healthtweets_dev/healthtweets/code/health_tweets/urls.py in <module>

admin.autodiscover() 

I am sure that I have installed python 1.6.2 and I can't find where the default module was imported in my code. Does anyone have some ideas? Thanks!

Upvotes: 2

Views: 4432

Answers (1)

If you've removed all instances of defaults, then it's one of 2 problems.

1: Your compiled python files are still referencing old data. Sometimes happens. Remove all pyc files in your project to force recompilation. find . -name "*.pyc" | xargs rm

2: An app in INSTALLED_APPS is still using <1.6 syntax to set up patterns. Search your site-packages directory for this pattern or remove third party apps from INSTALLED_APPS until you find it.

Upvotes: 3

Related Questions