Index: django/conf/global_settings.py =================================================================== --- django/conf/global_settings.py (revision 639) +++ django/conf/global_settings.py (working copy) @@ -51,6 +51,11 @@ # List of locations of the template source files, in search order. TEMPLATE_DIRS = () +# File extensions added to template names when doing something like {% extends "blah" %}. +TEMPLATE_FILE_EXTENSIONS = ( + ".html", +) + # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a # trailing slash. # Examples: "http://foo.com/media/", "/media/". Index: django/core/template_file.py =================================================================== --- django/core/template_file.py (revision 639) +++ django/core/template_file.py (working copy) @@ -1,20 +1,21 @@ "Wrapper for loading templates from files" -from django.conf.settings import TEMPLATE_DIRS +from django.conf.settings import TEMPLATE_DIRS, TEMPLATE_FILE_EXTENSIONS from template import TemplateDoesNotExist import os -TEMPLATE_FILE_EXTENSION = '.html' - def load_template_source(template_name, template_dirs=None): + if not TEMPLATE_FILE_EXTENSIONS: + raise TemplateDoesNotExist, "Your TEMPLATE_FILE_EXTENSIONS settings is empty. Change it to include at least one template file extension (an empty string is allowed)." if not template_dirs: template_dirs = TEMPLATE_DIRS tried = [] for template_dir in template_dirs: - filepath = os.path.join(template_dir, template_name) + TEMPLATE_FILE_EXTENSION - try: - return open(filepath).read() - except IOError: - tried.append(filepath) + for template_ext in TEMPLATE_FILE_EXTENSIONS: + filepath = os.path.join(template_dir, template_name) + template_ext + try: + return open(filepath).read() + except IOError: + tried.append(filepath) if template_dirs: error_msg = "Tried %s" % tried else: