django-user-accounts icon indicating copy to clipboard operation
django-user-accounts copied to clipboard

Pinax & AllAuth app labels are duplicate

Open iPoetDev opened this issue 1 year ago • 2 comments

Ask a question

Pinax uses an app called account and allauth has an app label called allauth.account, how to fix the app label clash between two third party apps. Can I adjust pinax account package as the app label is easier that allauths framework? I want to write a local patch and prefix or alias the django-user-account package.

  File "D:\Code\Code Institute\dash-and-do-github\manage.py", line 37, in <module>
    main()
  File "D:\Code\Code Institute\dash-and-do-github\manage.py", line 33, in main
    execute_from_command_line(sys.argv)
  File "D:\Code\Code Institute\dash-and-do-github\venv\Lib\site-packages\django\core\management\__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "D:\Code\Code Institute\dash-and-do-github\venv\Lib\site-packages\django\core\management\__init__.py", line 416, in execute
    django.setup()
  File "D:\Code\Code Institute\dash-and-do-github\venv\Lib\site-packages\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "D:\Code\Code Institute\dash-and-do-github\venv\Lib\site-packages\django\apps\registry.py", line 93, in populate
    raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, duplicates: account

as want to use Pina's Django-User-Account and may be AllAuth account together (one for a battery included account management) and the other for social logins, as I seek to integrate GitHub later.

INSTALLED_APPS += [
    'debug_toolbar',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
   #
    'account', # <=====
    'allauth',
    'allauth.account', # <==== 
    'anymail',
    'mail_templated',
    'widget_tweaks',
]

A quick search around on perplexity ai, gave this solution Pinax uses an app called account and allauth has an app label called allauth.account, how to fix the app label clash between two third party apps?

# myaccount/apps.py
from django.apps import AppConfig

class MyAccountConfig(AppConfig):
    name = 'myaccount'
    verbose_name = 'My Account'

    def ready(self):
        # Import Pinax's account app and rename its label
        from account ................................ #<=- missing AppConfig, what to import?
        
        AccountConfig.name = 'myaccount_pinax' # .name is missing to add, what to adjust

or I create a patch and repeat the apbove and give the account an AppConfig and a declared name that then I can import into my own project as above?

# Pinax's account/apps.py
from django.apps import AppConfig

class MyAccountConfig(AppConfig):
    name = 'account'
    verbose_name = 'Django-User-Account'

    def ready(self):
       
        AccountConfig.name = 'pinax_accounts' # .name is missing to add, what to adjust

and then repeat for my own package.

I want to write a patch for this and then fix pinax in requirements (as I am hosting on heroku(the snag) so it does not update, as production won't have local patch)

Please advise if I can tinker with the local install code, and how to best write a patch and add a app name to the accounts package or apps.py appconfig for the package.

This is not a bug, but it is a weird symbols clash as both are similar packages, not same problem space (or are they?)

iPoetDev avatar Sep 16 '23 15:09 iPoetDev