[Solved]-Model class doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS

14👍

My solution was to create a BaseModel abstract class on your models.py within your app, on your error this may be:

class BaseModel(models.Model):

    class Meta:
        abstract = True  # specify this model as an Abstract Model
        app_label = 'wdland'

And made all models inherit from this instead of the usual models.Model.

To solve it, I went to the basics of trying to figure out the error message, which states:

Model class wdland.models.Device doesn’t declare an explicit app_label and isn’t in an application in INSTALLED_APPS.

I also had the same error with a different app. Adding the requested “app_label” solved the issue.

0👍

Just adding "app name" to the installed apps in the settings file.
In my case the "app name" is proteins and my installed apps look like this

INSTALLED_APPS = [
'rest_framework',
'proteins',
# 'proteins.apps.ProteinsConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',

]

-3👍

I think you don’t have django.contrib.contenttypes this in INSTALLED_APPS of django settings.So add it in INSTALLED_APPS of django settings

Leave a comment