I have been trying to get two third party apps to play nice together, and it just hasn't been working for me, due to their names.
The two apps I am trying to get to work are django-user-accounts
and django-allauth
. The problem is, both apps are using the same namespace "account", and I don't understand the way I'm supposed to fix them.
I did find some things like this, which seem to be the way to go about fixing it, but when I try to implement it, I have two problems.
- It doesn't seem to do anything at all for django-user-accounts.
- With django-allauth, there are many different apps underneath the
allauth
package, and to get the account app folder for it, I have to also create theallauth
folder first, which makes those other apps inaccessible.
Here's what I have so far.
Under my project folder I created this structure:
allauth
├── account
│ ├── apps.py
│ └── __init__.py
└── __init__.py
In allauth.account.__init__
, I have:
from django.apps import AppConfig
default_app_config = 'allauth.account.apps.CustomAccountAppConfig'
In allauth.account.apps
I have:
from django.apps import AppConfig
class CustomAccountAppConfig(AppConfig):
verbose_name = 'custom account'
name = "allauth.account"
label = "custom_account"
def __init__(self, app_name, app_module):
AppConfig.__init__(self,app_name, app_module)
This appears to resolve the conflict with the name, but I then get ImportError: No module named 'allauth.socialaccount'
, because it has overridden the allauth package.
How can I solve this naming conflict and keep all other subpackages and applications working?
socialaccount
directory too just like you did foraccount
app – Distemperallauth.urls
file is not available. At this rate, I might as well just copy the entire app to my project. – Hopperalluth.account
but not forallauth.socialaccount
. Create a separateapp.config
for the previous. – Jeniferdjango-user-account
source code I think that the reason why the mentioned solution doesn't work is simply that they never defined an app. configuration. So, instead of trying to override theirs, why don't you just try to define it in your code? – Perriallauth
, there was a conflict with third-party one. It could have been solved by renaming package or by following popular convention by moving extension packages tocontrib
package in your project. – Nativeborn