[Django]-ImportError: No module named 'models' in Python 3

10👍

In Python 3 you must tell it when you are using relative imports:

from .models import ...

2👍

try from .models import Metric, Vote in your admin.py

0👍

I have always used:

from myapp.models import ...

Rather than a relative import. Just my personal preference. Perhaps relative import makes more sense if it is the admin.py for myapp, but I still like the explicitness of having the app name in the import.

Leave a comment