0

I am using django-allauth and its account app conflicts with my account app.

I managed to fix this conflict by creating an app label for allauth.account based on this solution

from django.apps import AppConfig


class AllAuthAccountConfig(AppConfig):
    name = 'allauth.account'
    label = 'allauth_account'
    verbose_name = 'aullauth_account'

and then adding it to installed apps

INSTALLED_APPS = (
    ...,
    'apps.allauth.apps.AllAuthAccountConfig',
    ...,
)

Now, when I try to migrate it gives an error

CommandError: Conflicting migrations detected; multiple leaf nodes in the migration graph: (0001_initial, 0002_email_max_length in allauth_account).
To fix them run 'python manage.py makemigrations --merge'

but python manage.py makemigrations --merge also fails with the following error:

ValueError: Could not find common ancestor of ['0001_initial', '0002_email_max_length']

How can I change the allauth.account app name so it doesn't conflict with my app or my migations?

CurlyError
  • 305
  • 2
  • 15
  • `allauth.account` has the following `("account", "0001_initial"),` as a dependency in the migration `0002_email_max_length` meaning if you change its label it will break, why don't you change your apps label instead? It's migration are in your complete control. See [ticket #23790](https://code.djangoproject.com/ticket/23790) – Abdul Aziz Barkat Jul 30 '21 at 14:26
  • @AbdulAzizBarkat I tried to change me app label, but it is a big project and it has a database that is being used. It gave me a lot of errors. Do you think it can be possible? – CurlyError Jul 30 '21 at 14:39
  • Ah in that case it seems it is simpler and / or easier to change allauth instead. You just might want to make your own custom fork of allauth and use that then (edit the migration files). [Replacing dependency with custom forks using pip](https://stackoverflow.com/questions/20731822/replacing-dependency-with-custom-forks-using-pip) might help you on doing that if you want to. – Abdul Aziz Barkat Jul 30 '21 at 15:13
  • This might be a solution. We might try it as well, and yes, I would appreciate it if you could help. – CurlyError Jul 30 '21 at 15:15
  • Uhh, I meant the linked question would be helpful for you. Though you can ask something if needed. Anyway all you need to do (hopefully) for code is to Change the line `("account", "0001_initial"),` in the migration, fork it and configure your requirements such that your custom fork is used. – Abdul Aziz Barkat Jul 30 '21 at 15:17

2 Answers2

0

you can use django rename app package package link. I have never use it personally but it seems to be good. you can try it

0

You can update app's verbose name in admin.py, like this

from django.apps import apps

# https://docs.djangoproject.com/en/4.1/ref/applications/#for-application-authors

apps.get_app_config('auth').verbose_name = "Auth Management"
apps.get_app_config('admin_interface').verbose_name = "Admin Interface"
david euler
  • 714
  • 8
  • 12