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',
]
- How does a .env file relate to Python / Django?
- Django doesn't create translation .po files
- Some strings not translated in django i18n module
- Django_auth_ldap no module named ldap
- Django F expression on datetime objects
-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
- Django Pipeline, Heroku, and SASS
- Include a view in a template
- Django_auth_ldap no module named ldap
- Django backup strategy with dumpdata and migrations