diff --git a/django/contrib/admin/__init__.py b/django/contrib/admin/__init__.py index 56b64faacb..ef3b40af33 100644 --- a/django/contrib/admin/__init__.py +++ b/django/contrib/admin/__init__.py @@ -8,9 +8,12 @@ def autodiscover(): not present. This forces an import on them to register any admin bits they may want. """ + import imp from django.conf import settings for app in settings.INSTALLED_APPS: try: - __import__("%s.admin" % app) + imp.find_module("admin", app.split(".")) except ImportError: - pass + # there is no admin.py in app, skip it. + continue + __import__("%s.admin" % app)