def autodiscover(blacklist=[]):
    """
    Automagically discover custom dashboards and menus for installed apps.
    Optionally you can pass a ``blacklist`` of apps that you don't want to
    provide their own app index dashboard.
    """
    import imp
    from django.conf import settings
    try:
        from importlib import import_module
    except ImportError:
        # Django < 1.9 and Python < 2.7
        from django.utils.importlib import import_module

    blacklist.append('admin_tools.dashboard')
    blacklist.append('admin_tools.menu')
    blacklist.append('admin_tools.theming')

    for app in settings.INSTALLED_APPS:
        # skip blacklisted apps
        if app in blacklist:
            continue

        # try to import the app
        try:
            app_path = import_module(app).__path__
        except AttributeError:
            continue

        # try to find a app.dashboard module
        try:
            imp.find_module('dashboard', app_path)
        except ImportError:
            continue

        # looks like we found it so import it !
        import_module('%s.dashboard' % app)
def autodiscover ( blacklist = [ ] ) : import imp from django . conf import settings try : from importlib import import_module except ImportError : from django . utils . importlib import import_module blacklist . append ( 'admin_tools.dashboard' ) blacklist . append ( 'admin_tools.menu' ) blacklist . append ( 'admin_tools.theming' ) for app in settings . INSTALLED_APPS : if app in blacklist : continue try : app_path = import_module ( app ) . __path__ except AttributeError : continue try : imp . find_module ( 'dashboard' , app_path ) except ImportError : continue import_module ( '%s.dashboard' % app )
Automagically discover custom dashboards and menus for installed apps.
    Optionally you can pass a ``blacklist`` of apps that you don't want to
    provide their own app index dashboard.