Hello,
I’m getting this error from running a custom django command:
Traceback (most recent call last):
File "/Users/arturschmal/Documents/GitHub/project_root/hotels/management/commands/fetch_data.py", line 5, in <module>
from hotels.models import Cities, Hotels
ModuleNotFoundError: No module named 'hotels'
This is my import in fetch_data.py
:
from hotels.models import Cities, Hotels
And this is my project tree:
project_root
├─ .venv
├─ README.md
├─ db.sqlite3
├─ hotels
│ ├─ __init__.py
│ ├─ admin.py
│ ├─ apps.py
│ ├─ management
│ │ ├─ __init__.py
│ │ └─ commands
│ │ ├─ __init__.py
│ │ └─ fetch_data.py
│ ├─ migrations
│ ├─ models.py
│ ├─ templates
│ ├─ tests.py
│ ├─ urls.py
│ └─ views.py
├─ manage.py
├─ maykin_case
│ ├─ __init__.py
│ ├─ __pycache__
│ ├─ asgi.py
│ ├─ settings.py
│ ├─ templates
│ ├─ urls.py
│ └─ wsgi.py
└─ requirements.txt
Am I making a mistake in setting up the file structure or relative path of the module import?