开发者

How to use Django templatetags in static media files?

Im using a flash gallery and the settings xml file is stored in /media/xml/gallery.xml

In the gallery.xml file I want to add this snippet of code:

<items>
    {% for image in images %}
    <item source="{{ MEDIA_URL }}{{ image.image }}" thumb="" description="{{ image.title }}" />
    {% endfor %}
</item>

But the source="... renders as such: http://127.0.0.1:8000/media/images/gallery开发者_StackOverflow中文版/%7B%7B%20MEDIA_URL%20%7D%7D%7B%7B%20image.image%20%7D%7D

Is there a way I can work around this problem? Thanks for the help.


You will have to serve this document via a Django view, and render it as a template.


Static media is, by definition, static. If you want Django mechanisms to work then you need to process using Django.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜