Application labels aren't unique, duplicates: account

Hello Developer’s there,
I am building a project based on Django in which I am using social login, and i’m getting error “Application labels aren’t unique, duplicates: account” can somebody help me out?

My installed apps:

INSTALLED_APPS = [
‘account.apps.AccountConfig’,
‘django.contrib.admin’,
‘django.contrib.auth’,
‘django.contrib.contenttypes’,
‘django.contrib.sessions’,
‘django.contrib.messages’,
‘django.contrib.staticfiles’,
‘django.contrib.sites’,
‘main’,
‘allauth’,
‘allauth.account’,
‘allauth.socialaccount’,
‘allauth.socialaccount.providers.google’,
]

Also if somebody know better way of social login please let me know.

1 Like

Your first App ‘account.apps.AccountConfig’ and ‘allauth.account’ may have the same label. Remove the first one I try to load the server again if this works that is the problem.

If you use AllAuth, Why do you have an app callde account?

2 Likes

After removing ‘account.apps.AccountConfig’ an runtime error is coming “Model class account.models.Registers doesn’t declare an explicit app_label and isn’t in an application in INSTALLED_APPS.”

I have an app called account for normal signups and using AllAuth for social login.

You will have to change its name, or the label, go to accounts.apps and change the verbose_name to something different like “normal_account”

When I change the label of account.app then a different error will come “Migration my_account.0003_delete_register dependencies reference nonexistent parent node (‘account’, ‘0002_registers’)”

also if i’m changing verbose_name nothing happening.

This kind of situation can derivate in lot of problems and it will need follow the tread of them for all the project. I will try to help you and anticipate to some problems.

If you change the name of the app and there are references to the models or any part of the app in your project there will be problems. If you are using a IDE or text editor with a refactoring tool you can use it(like Pycharm os VSCode), for example if in your file main.models you have:

from account.models import Account

class SomeModel(models.Model):
    account = models.ForeignKey(Account)

The import and the model field should be updated according the change you make it.

Know it is possible that even then you will have problems with your migrations. In my experience if you haven’t important data or are just in early development state the best is to delete all the migrations files and restore to an empty database, you can follow this link with more instructions.

I hope with this information you will be able to solve all the errors.

This was helpful for me as well. Deleting the ‘django.contrib.admin’ fixed my issue when I used an AdminConfig.