﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
24801	AppConfigs aren't loaded when the application is in a nested directory	Josh Smeaton	nobody	"We had someone in IRC trying to use a custom AppConfig with an application that was installed to a subdirectory called ""apps"". The AppConfig wasn't being picked up, and the import_module machinery was throwing errors. I've replicated this locally too.

Application at: project/top/drill/

{{{

INSTALLED_APPS = [
    'top.drill',  # with default_app_config 
    'top.drill.apps.DrillConfig',  # without default_app_config
]

$ ./manage.py shell
Traceback (most recent call last):
  File ""./manage.py"", line 9, in <module>
    execute_from_command_line(sys.argv)
  File ""/vagrant/venv/lib/python3.3/site-packages/django/core/management/__init__.py"", line 427, in execute_from_command_line
    utility.execute()
  File ""/vagrant/venv/lib/python3.3/site-packages/django/core/management/__init__.py"", line 391, in execute
    django.setup()
  File ""/vagrant/venv/lib/python3.3/site-packages/django/__init__.py"", line 21, in setup
    apps.populate(settings.INSTALLED_APPS)
  File ""/vagrant/venv/lib/python3.3/site-packages/django/apps/registry.py"", line 85, in populate
    app_config = AppConfig.create(entry)
  File ""/vagrant/venv/lib/python3.3/site-packages/django/apps/config.py"", line 137, in create
    app_module = import_module(app_name)
  File ""/vagrant/venv/lib64/python3.3/importlib/__init__.py"", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File ""<frozen importlib._bootstrap>"", line 1584, in _gcd_import
  File ""<frozen importlib._bootstrap>"", line 1565, in _find_and_load
  File ""<frozen importlib._bootstrap>"", line 1529, in _find_and_load_unlocked
ImportError: No module named 'drill'
}}}

Problem happens using default_app_config or by referencing the AppConfig from INSTALLED_APPS. I suspect there's a problem related to importing modules when the application isn't in the project root directory.

I think that https://code.djangoproject.com/ticket/23470 was the same problem, but it was never fully investigated."	Bug	closed	Core (Other)	dev	Normal	invalid			Unreviewed	0	0	0	0	0	0
