I have the following structure for my project:
myproject/
|-- myproject/
| |-- __init__.py
| |-- settings.py
| |-- urls.py
| |-- wsgi.py
|-- apps/
| |-- dashboard/
| | |-- static/
| | |-- templates/
| | |-- __init__.py
| | |-- admin.py
| | |-- apps.py
| | |-- forms.py
| | |-- models.py
| | |-- tests.py
| | |-- views.py
| |-- data/
| | |-- __init__.py
| | |-- apps.py
| | |-- models.py
| | |-- router.py
| | |-- tests.py
| |-- __init__.py
|-- manage.py
The settings file has these installed apps added:
'apps.data',
'apps.dashboard',
In the main project I can import from the apps I've created no issues. However, the dashboard app is dependant on the data app and I can't seem to import from the data app.
urls.py imports 'import apps.dashboard.views' with no issues but I've tried a number of things to import the models from data into dashboard. I'm using the models from data in the dashboard views.
None of the following work:
from data.models import ModelName
from apps.data.models import ModelName
from .data.models import ModelName
from .apps.data.models import ModelName
I get 'ImportError: No module named data.models' regardless.
In the apps.py files the DataConfig class has the names set to 'dashboard' and 'data'.
Can anyone explain how I can access the models from data in dashboard?
Thanks