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' %}?
How to setup it?
There is no media template tag.
Having set MEDIA_ROOT
and MEDIA_URL
you can use a media file in a template by referring to its url
attribute.
For example:
class Foo(models.Model):
image = models.ImageField(
...
)
and then in your template:
<img src="{{ foo_object.image.url }}">
Also, take a look at the docs about how to access media files.