Django找不到模板


问题内容

我知道很多人都问过这个问题,但是尽管对我的模板目录的路径进行了硬编码,但我似乎无法让Django找到我的模板。

这是settings.py

TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
#django.template.loaders.eggs.Loader',
)

TEMPLATE_DIRS = (
    "/Users/full/path/to/marketing_site/templates",
)

这是views.py文件:

def static (request, feature_page):

# this will get the appropriate feature page template.
template = loader.get_template('features/pricing.html')
c = RequestContext(request,{
})
return HttpResponse(template.render(c))

在主文件夹中是模板文件夹和应用程序文件夹。我曾经将应用程序与settings.py放在同一文件夹中,但是django 1.4似乎更改了默认文件结构。

我的错误是:

TemplateDoesNotExist at /features/pricing

Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.Loader:
Using loader django.template.loaders.app_directories.Loader:
/Library/Python/2.7/site-packages/django/contrib/auth/templates/feature_pricing.html (File does not exist)

更新:
我的网页日志将TEMPLATE_DIRS列为()。

如果我在TEMPLATE_DIRS的settings.py页面上放置打印语句,则可以得到TEMPLATE_DIRS的打印输出……因此,某种程度上,TEMPLATE_DIRS并未被使用(从外观上看)


问题答案:

我在settings.py中添加了一个额外的TEMPLATE_DIR

:(