django媒体url标签 [英] django media url tag
本文介绍了django媒体url标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
django是否具有 media
标记,类似于 static
和 url
以及如何设置?
Does django have media
tag similar to static
and url
and how to setup it?
{% static 'styles/boo.css' %}
{% url 'some_app:some_name' %}
Is this possible: {% media 'what here' %}?
如何设置?
推荐答案
您需要 {%get_media_prefix%}
。
设置方法如下在文档中 :您必须在设置中设置 MEDIA_ROOT
和 MEDIA_URL
并添加 MEDIA_URL
到您的 urls.py
。
The way to set it up is explained in the docs: you have to set the MEDIA_ROOT
and the MEDIA_URL
in your settings and add the MEDIA_URL
to your urls.py
.
这篇关于django媒体url标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文