如何在Django上更改第三方应用程序的名称?

2024-10-02 12:33:53 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用django-allauth,其account应用程序与我的account应用程序冲突

我基于this solution为allauth.account创建了一个应用程序标签,从而解决了这个冲突

from django.apps import AppConfig


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

然后将其添加到已安装的应用程序中

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

现在,当我尝试迁移时,会出现一个错误

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'

但是python manage.py makemigrations --merge也会失败,并出现以下错误:

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

如何更改allauth.account应用程序名称,使其不与我的应用程序或我的migations冲突


Tags: appsdjangonamein应用程序manageemail错误

热门问题