Home > database >  How do I specify the path of the config class in INSTALLED_APPS in Django?
How do I specify the path of the config class in INSTALLED_APPS in Django?

Time:04-30

The following tree, show my Django project structure. Now, in plain English, how do I add a new entry to INSTALLED_APPS in Django setting.py? (have already wasted 6 hours on this :(

|   manage.py
|   db.sqlite3
|   
 ---journal
|   |   asgi.py
|   |   settings.py
|   |   urls.py
|   |   wsgi.py
|   |   __init__.py
|           
\---apps
    \---cards
        |   admin.py
        |   apps.py
        |   models.py
        |   tests.py
        |   urls.py
        |   views.py
        |   __init__.py

enter image description here

CodePudding user response:

Actually, you only add the name of the app in INSTALLED_APPS.

Example

Your app name is "cards", inside of apps.

INSTALLED_APPS = [
    ...
    'django.contrib.staticfiles',
    'apps.cards',
]

CodePudding user response:

Finally I found the problem. I should have modified the config class itslef! Inside CardsConfig I had to change the name from Cards into 'apps.cards'.

  • Related