Ticket #19548: namespace_search.diff

File namespace_search.diff, 1.1 KB (added by mcanix@…, 12 years ago)

Diff for module path template lookup

  • django/template/loaders/app_directories.py

    diff --git a/django/template/loaders/app_directories.py b/django/template/loaders/app_directories.py
    index 887f8a0..e889a27 100644
    a b for app in settings.INSTALLED_APPS:  
    2323        mod = import_module(app)
    2424    except ImportError as e:
    2525        raise ImproperlyConfigured('ImportError %s: %s' % (app, e.args[0]))
    26     template_dir = os.path.join(os.path.dirname(mod.__file__), 'templates')
    27     if os.path.isdir(template_dir):
    28         if not six.PY3:
    29             template_dir = template_dir.decode(fs_encoding)
    30         app_template_dirs.append(template_dir)
     26
     27    # Search ALL the directories in the app module path
     28    for path in mod.__path__:
     29        template_dir = os.path.join(path, 'templates')
     30        if os.path.isdir(template_dir):
     31            if not six.PY3:
     32                template_dir = template_dir.decode(fs_encoding)
     33            app_template_dirs.append(template_dir)
    3134
    3235# It won't change, so convert it to a tuple to save memory.
    3336app_template_dirs = tuple(app_template_dirs)
Back to Top