os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', 'templates'))
As far as where the templates folder should go, I don't know since Django 1.4 just came out and I haven't looked at it yet. You should probably ask another question on SE to solve that issue.
You can also use normpath
to clean up the path, rather than abspath
. However, in this situation, Django expects an absolute path rather than a relative path.
For cross platform compatability, use os.pardir
instead of '..'
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…