1

my project structure is like below:

./apps
./apps/bizusers
./apps/bizusers/admin.py
./apps/bizusers/apps.py
./apps/bizusers/models.py
./apps/bizusers/serializers.py
./apps/bizusers/tests.py
./apps/bizusers/views.py
./apps/bizusers/__init__.py
./apps/__init__.py
./config
./config/asgi.py
./config/settings.py
./config/urls.py
./config/wsgi.py
./config/__init__.py
./manage.py
./requirements.txt

My custom user model is in

./apps/bizusers/models.py

I have this in settings:

INSTALLED_APPS = [ 'apps', ]

I added AUTH_USER_MODEL = "bizusers.User" in settings.py

I have tried to edit ./apps/__init__.py and ./apps/bizusers/apps.py but I cannot get it to work.

I have tried these solutions below:

having models directory and AUTH_USER_MODEL

Model in sub-directory via app_label?

'MyAppConfig' must supply a name attribute

Thanks.

Aatish Kumar
  • 149
  • 2
  • 15

1 Answers1

1

You can have your apps as subpackages of another package, but then you do need to add your app to the INSTALLED_APPS list, i.e. instead of adding apps you need to be adding the subpackages of it in the list:

INSTALLED_APPS = [
    ...
    'apps.bizusers',
]

Next your setting for AUTH_USER_MODEL is correct:

AUTH_USER_MODEL = "bizusers.User"
Abdul Aziz Barkat
  • 19,475
  • 3
  • 20
  • 33
  • Hi @Abdul, I get this error `AttributeError: Manager isn't available; 'auth.User' has been swapped for 'bizusers.User'` – Aatish Kumar Apr 28 '21 at 08:58
  • @AatishKumar that means this setting did work, you now get this error because you try to use the default user model somewhere in your code. Please [edit](https://stackoverflow.com/posts/67294774/edit) and add the full stack trace of this error to your question. – Abdul Aziz Barkat Apr 28 '21 at 09:01
  • yes, i realised that just after i put my comment. Thank you. :) – Aatish Kumar Apr 28 '21 at 09:02