Answer the question
In order to leave comments, you need to log in
How to connect a new application correctly?
How to correctly connect a new application in Django?
In different sources I met two ways:
1) in the official documentation such an option is given
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'newapp.apps.NewappConfig', # new app
]
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'newapp', # new app
]
Answer the question
In order to leave comments, you need to log in
What's wrong with the official description? Here is my free translation:
To configure the application, create an apps.py module inside the application, then define a class here - an AppConfig instance.
When INSTALLED_APPS contains a dot-separated path to an application module, by default, if Django finds only one instance of the AppConfig class in the apps.py module, it uses that configuration for the application. This behavior can be disabled by setting AppConfig.default to False.
If the apps.py module contains more than one instance of the AppConfig class, Django will use the one that has AppConfig.default set to True.
If no AppConfig instances are found, the base AppConfig will be used.
Alternatively, INSTALLED_APPS may contain a dot-separated path to the class to specify it explicitly:
INSTALLED_APPS = [ ... 'polls.apps.PollsAppConfig', ... ]
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
...
INSTALLED_APPS = [
'django.contrib.admin.apps.AdminConfig',
'django.contrib.auth.apps.AuthConfig',
...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question