Skip to content Skip to sidebar Skip to footer

Django Fails To Import Any Package : Attributeerror: __name__

For some reasons, I had to reinstall Python on my desktop. Since then, my django applications are not working. I can create one, but as soon as I import a package anywhere in the a

Solution 1:

Got this annoying error after aborting an IDE-refactoring.

I suggest the following to reproduce the problem:

  • Revert git changes.
  • Make sure there are no cyclic imports in your code.
  • Reinstall virtual environment.

Unfortunately the error was still there in my case. So I knew the problem must be with python. And indeed:

  • Reinstalling python 3.7 solved the problem.

Solution 2:

Did you pip install django?

I think when you reinstalled Python you didn't installed packaged like Django

Solution 3:

Uninstall the current Django package and install Django 2.1.5

Use this command on windows:

pip install --user django==2.1.5

Post a Comment for "Django Fails To Import Any Package : Attributeerror: __name__"