Reputation: 159
I seem to have a problem for awhile now i just cant understand.
While trying to go into my Django admin site, i keep getting import error at /admin/ no module named tools. The thing is, i had an app named tools, but removed it from the project. But am still getting the import error at admin, no module named tools. After a bit of googling on stackoverflow, i found a article that suggested deleting all pyc files as they contain old data still being referenced, which makes sense. But after removing every pyc file i could see in my current project directory i still get the error.
Heres where it gets weird.
I am using django_tables2. I also have a books app which tracks books information. I created a table class for the books app and specified a table column to be a link column. When viewing the index page of the books app i get the import error at /books/ no module named tools, yet there is no reference to tools at all in the books app?? I get the same error import error at /admin/ no module named tools. But if i change the LinkColumn in the books app table class back to a normal column, just changing the verbose name, the error goes away with the books app index page but still persists with admin?? I honestly have no clue whats going on here.
Edit: Even after starting a new tools app and registering it in admin.py its the same error. The only thing i can think of its a path error but how and why, if it can find the other apps in the same directory?
I am more than willing to post any code i have if required but i have no idea where to even start looking.
Traceback:
File "django/core/handlers/base.py" in get_response
114. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "django/contrib/admin/sites.py" in wrapper
215. return self.admin_view(view, cacheable)(*args, **kwargs)
File "django/utils/decorators.py" in _wrapped_view
99. response = view_func(request, *args, **kwargs)
File "django/views/decorators/cache.py" in _wrapped_view_func
52. response = view_func(request, *args, **kwargs)
File "django/contrib/admin/sites.py" in inner
198. return view(request, *args, **kwargs)
File "django/views/decorators/cache.py" in _wrapped_view_func
52. response = view_func(request, *args, **kwargs)
File "django/contrib/admin/sites.py" in index
358. model_dict['admin_url'] = reverse('admin:%s_%s_changelist' % info, current_app=self.name)
File "django/core/urlresolvers.py" in reverse
480. app_list = resolver.app_dict[ns]
File "django/core/urlresolvers.py" in app_dict
310. self._populate()
File "django/core/urlresolvers.py" in _populate
285. lookups.appendlist(pattern.callback, (bits, p_pattern, pattern.default_args))
File "django/core/urlresolvers.py" in callback
229. self._callback = get_callable(self._callback_str)
File "django/utils/functional.py" in wrapper
32. result = func(*args)
File "django/core/urlresolvers.py" in get_callable
100. not module_has_submodule(import_module(parentmod), submod)):
File "django/utils/importlib.py" in import_module
40. __import__(name)
Exception Type: ImportError at /admin/
Exception Value: No module named tools
Upvotes: 0
Views: 993
Reputation: 1948
For anyone that stumbles upon this question:
I've experienced an error like this before, got it working by commenting out url patterns in urls.py
. There may be a rouge import in one of your views and since your admin panel imports all views found in your url patters, try commenting them out 1 by 1 and you might spot the culprit.
Upvotes: 1