开发者

How is the template directory set in App Engine?

开发者 https://www.devze.com 2023-02-27 08:54 出处:网络
I\'m currently keeping my templates in /projectdir/static/html/. I\'ve begun to have enough of them that I\'ve created a subdirectory: /projectdir/static/html/tag_request/. If I want to have a templat

I'm currently keeping my templates in /projectdir/static/html/. I've begun to have enough of them that I've created a subdirectory: /projectdir/static/html/tag_request/. If I want to have a template in /tag_request/ inherit from one in /html/ how do I do it?

I've开发者_运维问答 read that with django {% extends base.html %} should be written relative to /projectdir/templates/ or wherever TEMPLATE_DIRS points. How do I set TEMPLATE_DIRS in appengine (or do I have to put my templates in /projectdir/templates/)?

Thanks!


It seems to depend on which version of Django you are using.

If you're using 0.96, then just this works:

{% extends ../base.html %}

If you're using 1.2, then in theory you need to create a settings.py which sets the TEMPLATE_DIRS to /projectdir/static/html/, and then use this:

{% extends base.html %}

However I found a couple of issues with this - my solution is described here:

App engine default Django version change

0

精彩评论

暂无评论...
验证码 换一张
取 消