I am using Django 1.10, and I created a folder called apps
. I want to put all my apps inside this directory, but when I try to import appA.models
inside appB.models
I get this error.
RuntimeError: Model class appA.models.model doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
Both apps are declared in installed apps like this apps.appA
. All folders have the init file.
The Solution was to create a folder named applications with an __init__.py
file inside. Each app must have the file apps.py
with this content
from __future__ import unicode_literals
from django.apps import AppConfig
class AppnameConfig(AppConfig):
name = 'appname'
Also in the in settings.py
INSTALLED_APPS
, call the applications with this format applications.appname
.