[英]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 我正在使用Flash Gallery,设置xml文件存储在/media/xml/gallery.xml中
In the gallery.xml file I want to add this snippet of code: 我要在gallery.xml文件中添加以下代码段:
<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/%7B%7B%20MEDIA_URL%20%7D%7D%7B%7B%20image.image%20%7D%7D 但是source =“ ...的呈现方式如下: http : //127.0.0.1 : 8000/media/images/gallery/%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.
谢谢您的帮助。
您将必须通过Django视图提供此文档,并将其呈现为模板。
Static media is, by definition, static. 根据定义,静态媒体是静态的。 If you want Django mechanisms to work then you need to process using Django.
如果您希望Django机制起作用,则需要使用Django进行处理。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.