#33378: django.core.exceptions.ImproperlyConfigured Error when installing apps
in
subdirectory
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
alphazwest |
Type: Bug | Status: new
Component: Core | Version: 4.0
(Other) | Keywords: Apps, Subdirectory,
Severity: Normal | Installation
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
4.0 Throws an exception when installing apps that are located in
subdirectories.
Example, for a project of such structure:
{{{
.
└── DjangoProject/
└── Apps/
├── bestapp/
│ ├── migrations
│ ├── __init__.py
│ ├── admin.py
│ ├── apps.py
│ ├── models.py
│ ├── tests.py
│ └── views.py
└── ...
}}}
When adding this line to DjangoProject/settings.py:
{{{
INSTALLED_APPS = [
...
'Apps.bestapp.apps.BestappConfig'
]
}}}
The following exception is thrown when running {{{python manage.py
makemigrations}}}:
{{{
django.core.exceptions.ImproperlyConfigured: Cannot import 'bestapp'.
Check that 'Apps.bestapp.apps.BestappConfig.name' is correct.
}}}
The current workaround is to go into the Apps/bestapp/apps.py file and
make the following change:
Auto-generated version:
{{{
class BestappConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'bestapp'
}}}
Manually-Updated version:
{{{
class BestappConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'Apps.bestapp'
}}}
Note the change being adding the parent directory here: {{{name =
'Apps.bestapp' }}}
IIRC, there was a syntax change for app installation somewhere in 3.x. Not
sure if this is a product of that change or something else.
--
Ticket URL: <https://code.djangoproject.com/ticket/33378>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/053.33b4bfb30f01af629f5420f6edbf8343%40djangoproject.com.