mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Refs #32915 -- easier to understand traceback from _gcd_import
This commit is contained in:
parent
5d13cc540e
commit
8f86f295ab
@ -189,8 +189,12 @@ class AppConfig:
|
|||||||
msg += " Choices are: %s." % ", ".join(candidates)
|
msg += " Choices are: %s." % ", ".join(candidates)
|
||||||
raise ImportError(msg)
|
raise ImportError(msg)
|
||||||
else:
|
else:
|
||||||
# Re-trigger the module import exception.
|
try:
|
||||||
import_module(entry)
|
# Re-trigger the module import exception.
|
||||||
|
import_module(entry)
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
raise ImportError(
|
||||||
|
f"The following module was not found, install the dependency or remove it from INSTALLED_APPS: {entry}")
|
||||||
|
|
||||||
# Check for obvious errors. (This check prevents duck typing, but
|
# Check for obvious errors. (This check prevents duck typing, but
|
||||||
# it could be removed if it became a problem in practice.)
|
# it could be removed if it became a problem in practice.)
|
||||||
|
Loading…
Reference in New Issue
Block a user