I have created a new app "grn" in my django project and tried to import the models from another app named "packsapp" in the same project like this:
Models.py
from ..packsapp.models import *
But I got the following error:
ValueError: attempted relative import beyond top-level package
Here's the structure of the app:
yantra_packs
grn
--migrations
__init__.py
admin.py
apps.py
models.py
tests.py
views.py
media
packsapp
--migrations
templates
templatetags
views1
__init__.py
apps.py
decorators.py
forms.py
models.py
urls.py
views.py
How can I import the models of the packsapp
in the grn
??
from project_root.app_name.models import *
- Meha ParekhModuleNotFoundError: No module named 'yantra_packs.packsapp'
- Rahul Sharmapacksapp
in installed_apps in settings.py file? - Meha Parekh