Forums

Import Error

Hi there.

While trying to go into my 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. and random apps. A bit of googling on stackoverflow 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 etc. I created a table class for the books and specified a table column to be a link column. When viewing the books app i get the import error at /books/ no module named tools, same at import error at /admin/ no module named tools. But if i change the LinkColumn in the books table class to a normal column, just changing the verbose name, the error goes away with the books app but is still with admin?? I 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?

Is tools still referenced somewhere, like in settings.py?

What do you get if you do a search for possible imports of "tools" around the place?

grep -Ir tools .
grep -Ir "from tools" .
grep -Ir "import tools" .

The other thing that can cause "no module named bla" types of errors, is if said modules have syntax errors in them... Could there be anything like that around?

The final bit of weirdness that could be involved is that, if you're using a virtualenv, the activate_this script doesn't actually remove system-site-packages from the local environment. So could there be some sort of naming conflict or clash with one of the system packages?

Hi there :)

I apologize but i found a solution yesterday and just completely forgot to update this thread.

The urls was importing views i had'nt properly implemented yet as up until yesterday i never knew that django's admin imported all the urls at once. I thought it only used what was called at the time. Still so much to learn :) So that so far as i can tell, that is what caused the error :) After removing all but the essential urls caused the admin to load correctly. I think i was just getting ahead of myself really.

Thank you for the help though, i will keep those in mind for future use.

glad you figured it out!