Django: class X class does not declare an explicit app_label string and is either not in the app in INSTALLED_APPS

He looked for other solutions on stackoverflow but didn't get it.

The structure of my project is as follows:

src
|
|---project
         |
         | settings.py
         | apps
             |
             |
             __init__.py
             app1
              |.....
             app2
             app3
      

Run codeHide result


My settings.py 

INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'project.apps.App1Config',
'project.apps.App2Config',
'project.apps.App3Config',
'project.apps.App4Config',
'project.apps.ProjectConfig',)


apps/__init__.py

class App1Config(AppConfig):
        name = 'project.apps.app1'
        verbose_name = "App"

      

And it still appears in the console:

RemovedInDjango19Warning: The project.models.Model model class does not declare an explicit app_label string and is either not in the application in INSTALLED_APPS or was imported before the application was loaded. This will no longer be supported in Django 1.9.

RemovedInDjango19 Warning: model class project.apps.app1.models.Model does not declare an explicit app_label and is either not in the application in INSTALLED_APPS or was otherwise imported before the application was loaded. This will no longer be supported in Django 1.9.

+3


source to share


1 answer


Try to customize your application name like this:



class App1Config(AppConfig):
    name = '**app1**'
    verbose_name = "App"

      

-1


source







All Articles