简体   繁体   English

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

[英]How to change the name of a third party app on Django?

I am using django-allauth and its account app conflicts with my account app.我正在使用django-allauth ,它的account应用程序与我的account应用程序冲突。

I managed to fix this conflict by creating an app label for allauth.account based on this solution我设法通过基于此解决方案为 allauth.account 创建应用程序标签来解决此冲突

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:但是python manage.py makemigrations --merge也失败并出现以下错误:

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?如何更改 allauth.account 应用程序名称,使其与我的应用程序或迁移不冲突?

you can use django rename app package package link .您可以使用 django 重命名应用程序包包链接 I have never use it personally but it seems to be good.我个人从未使用过它,但它似乎很好。 you can try it你可以试试看

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM