Search code examples
pythondjangodjango-urls

django media url tag


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?


Solution

  • You need {% get_media_prefix %}.

    The way to set it up is explained in the docs: you have to set MEDIA_ROOT and MEDIA_URL in your settings and add MEDIA_URL to your urls.py.