I have a problem with django-rest-framework

if i doing makemigrations and migrate this happens in pycharm

django.core.exceptions.ImproperlyConfigured: AUTH_USER_MODEL refers to model 'app.User' that has not been installed

This error means Django can't find the User model in the app referenced by AUTH_USER_MODEL. It's almost always one of these causes:

1. The app isn't in INSTALLED_APPS

Check your settings.py:

INSTALLED_APPS = [
    ...
    'app',  # <-- must be listed here
]

If your app is nested, e.g. myproject/app, or has an AppConfig, you may need the full dotted path instead, like 'app.apps.AppConfig' or 'myproject.app'.

2. AUTH_USER_MODEL doesn't match the app's actual label

AUTH_USER_MODEL = 'app.User'

The part before the dot must be the app's label (usually the app folder name, or whatever's set as label in the app's AppConfig), not the project name or an arbitrary string. Check app/apps.py:

class AppConfig(AppConfig):
    name = 'app'
    label = 'app'  # this is what AUTH_USER_MODEL should reference

3. There's no User model actually defined in app/models.py

Make sure you have something like:

from django.contrib.auth.models import AbstractUser

class User(AbstractUser):
    pass

4. Circular/ordering issue — if app depends on another app that isn't installed, or is misspelled (e.g. 'apps' vs 'app'), you'll get this same error.

Quick checklist to fix:

  1. Run python manage.py shell and try from django.apps import apps; print(apps.get_app_configs()) — confirm your app shows up with the label you expect.

  2. Double check spelling/case in both INSTALLED_APPS and AUTH_USER_MODEL — they're case-sensitive and must match exactly.

  3. If you just added a custom user model to an existing project, make sure you haven't already run migrations with the default auth.User — that's a separate, messier problem requiring a fresh database or careful migration surgery.

If you paste your INSTALLED_APPS, AUTH_USER_MODEL line, and app/apps.py, we might be able to pinpoint the exact mismatch.

Вернуться на верх