2

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

asked Nov 10 at 3:58
1
  • 1
    Can you share the AccountsConfig for example? Commented Nov 10 at 7:33

2 Answers 2

1
  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.

answered Nov 10 at 8:21
Sign up to request clarification or add additional context in comments.

1 Comment

Good answer! I'd also suggest adding label = 'accounts' and label = 'ads' to your AppConfig classes. This way you can use "python manage.py makemigrations accounts" instead of having to write the full path apps.accounts in migration commands.
1

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.

answered Nov 10 at 9:38

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.