He tenido problemas con esto y no puedo encontrar la solución... He examinado todas las SO preguntas sobre esto, pero nada funcionó en mi caso... Así que aquí está el problema:
manage.py y hago un python manage.py makemigrations que da como resultado from foo.bar.data import CoolioClass
ImportError: No module named foo.bar.data
Mis directorios se ven así (solo como ilustración):
project_root/ ├──env/ ├──django/ │ ├── app │ │ └── models.py (from foo.bar.data import CoolioClass) │ ├── django │ │ └── settings.py │ └── manage.py └──foo/ ├── bar │ ├── __init__.py │ ├── data.py │ └── test.py ├── baz │ ├── __init__.py │ ├── data.py │ └── test.py └── __init__.py Cuando sys.path en Python Shell, da como resultado:
/home/johnny/project_root/env/lib/python2.7 /home/johnny/project_root/env/lib/python2.7/plat-x86_64-linux-gnu /home/johnny/project_root/env/lib/python2.7/lib-tk /home/johnny/project_root/env/lib/python2.7/lib-old /home/johnny/project_root/env/lib/python2.7/lib-dynload /usr/lib/python2.7 /usr/lib/python2.7/plat-x86_64-linux-gnu /usr/lib/python2.7/lib-tk /home/johnny/project_root/env/local/lib/python2.7/site-packages /home/johnny/project_root/env/lib/python2.7/site-packages