开发者

How to use Django templatetags in static media files?

开发者 https://www.devze.com 2022-12-19 20:07 出处:网络
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:

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

精彩评论

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