Skip to content
Home » Django model “doesn’t declare an explicit app_label”

Django model “doesn’t declare an explicit app_label”

To solve the Django model “doesn’t declare an explicit app_label”. It took me a long time to realise that I had an init.py in the same directory as the django manage.py.

Have you forgotten to include your application’s name in the settings file? The default class generated by the .manage.py createapp myAppName command at apps.py is myAppNameConfig. Where myAppName is your app’s name.

Make sure that you have added 'django.contrib.sites' to the installed apps and also refer the below solution.

In settings.py:

INSTALLED_APPS = [
'myAppName.apps.myAppNameConfig',
'django.contrib.admin',

'django.contrib.contenttypes',
'django.contrib.auth',
'django.contrib.sessions',

'django.contrib.staticfiles',
'django.contrib.messages'
]

The settings file learns what you wish to call your programme this way. Later, in the apps.py file, you can change how it looks by adding the following code.

myAppName/apps.py

class myAppNameConfig(AppConfig):
    name = 'myAppName'
    verbose_name = 'A good Name'

Also find:

ImportError: No module named ‘exceptions’

Tags: