-1
from django.apps import AppConfig


class App1Config(AppConfig):
    default_auto_field = 'django.db.models.BigAutoField'
    name = 'app1'
Shiro
  • 21
  • 6
  • 1
    Does this answer your question? [What is the purpose of app.py in django apps?](https://stackoverflow.com/questions/17533631/what-is-the-purpose-of-app-py-in-django-apps) – Shivendra Pratap Kushwaha Jul 18 '21 at 03:35
  • Stack Overflow is not intended to replace existing tutorials and documentation, but it happens that there's a previous question on this. – Karl Knechtel Jul 18 '21 at 04:26

1 Answers1

4

The best explaination is already provided by Django documentation.

To configure an application, create an apps.py module inside the application, then define a subclass of AppConfig there.

When INSTALLED_APPS contains the dotted path to an application module, by default, if Django finds exactly one AppConfig subclass in the apps.py submodule, it uses that configuration for the application. This behavior may be disabled by setting AppConfig.default to False.

If the apps.py module contains more than one AppConfig subclass, Django will look for a single one where AppConfig.default is True.

If no AppConfig subclass is found, the base AppConfig class will be used.

  • So, if you have just one AppConfig subclass then is it true that the value of AppConfig.default is irrelevant? – Phil O Aug 07 '21 at 10:58