Django REST project doesn’t detect apps inside the “apps” directory when running makemigrations

I have a Django REST project where I created a directory called apps to store all my apps. Each app is added to the INSTALLED_APPS list in my settings file like this:

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    # APPS
    'apps.accounts.apps.AccountsConfig',
    'apps.ads.apps.AdsConfig',
]

But when I run python manage.py makemigrations, Django doesn’t detect any changes — it seems like it doesn’t recognize my apps at all. Can anyone help me figure out what might be wrong? Thanks a lot

  1. Open apps/accounts/apps.py (similar for your other apps like ads).

  2. You need to update the name attribute in the AccountsConfig class to match the full dotted path:

  3. from django.apps import AppConfig
    
    class AccountsConfig(AppConfig):
        default_auto_field = 'django.db.models.BigAutoField'
        name = 'apps.accounts'  # Change here
    
  4. Do the same for apps/ads/apps.py:

    from django.apps import AppConfig
    
    class AdsConfig(AppConfig):
        default_auto_field = 'django.db.models.BigAutoField'
        name = 'apps.ads'  # Change here
    
  5. After making these changes, run python manage.py makemigrations again.

It should work, if not then please let me know.

The previous answer is correct about updating the name attribute, but I'd suggest also adding the label attribute to make your life easier when working with migrations.

In apps/accounts/apps.py:

from django.apps import AppConfig

class AccountsConfig(AppConfig):
    default_auto_field = 'django.db.models.BigAutoField'
    name = 'apps.accounts'  # Full dotted path to the app
    label = 'accounts'       # Short name for the app

And in apps/ads/apps.py:

from django.apps import AppConfig

class AdsConfig(AppConfig):
    default_auto_field = 'django.db.models.BigAutoField'
    name = 'apps.ads'
    label = 'ads'

Why add label?

The label attribute allows you to reference the app by its short name in management commands. Without it, you'd have to use the full path like:

python manage.py makemigrations apps.accounts

But with the label set, you can simply use:

python manage.py makemigrations accounts

This keeps your commands cleaner and is especially helpful when you have deeply nested app structures.

After making these changes, run python manage.py makemigrations and it should detect your models properly.

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