I have a project in which the directory structure is as follows:
mywebsite/ manage.py __init__.py myapp/ models/ __init__.py base.py
myapp / models / base.py contains:
class X(object): pass
myapp / models / __ init__.py contains:
from base import X
Now, if I use the manage.py shell, I may have the following session:
> import mywebsite.myapp.models > import myapp.models > mywebsite.myapp.models.X == myapp.models.X False
However, if I modify myapp / models / __ init__.py to be:
from myapp.models.base import X
Then I get True as expected.
I think I'm missing something about how imports work or how Django changes paths when using the manage.py shell.
Can anyone explain this?
source share