2011-06-17 42 views
4

我有這樣的目錄結構擴展base.html文件我index.html中用於擴展base.html文件:不能從父目錄

{% extends "../base.html" %} 

這是index.py的代碼:

path = os.path.join(os.path.dirname(__file__), 'pages/it/index.html') 
     self.response.out.write(template.render(path, template_values)) 

這將是正確的方法?我正在使用谷歌webapp和djagno模板。

回答

2

您不能在擴展標記中使用類似的路徑。但是你不需要 - 假設你的TEMPLATE_DIRS設置爲root/pages,你只需要做extends "base.html"

+0

謝謝。我使用Google搜索template_dirs,發現了一些問題:http://code.google.com/p/googleappengine/issues/detail?id=2661 –