1
votes

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.

2
Does apps folder have an __init__.py? - allcaps

2 Answers

2
votes

Create a "init.py" named empty file first in your apps folder. Now in root settings.py file in INSTALLED_APPS add all you apps then it will work.

1
votes

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 the settings instaled apps, call the applications with this format 'applications.appname'