Django – Absolute media URIs from templates
Sometimes, you need to build an absolute URI to a media file from your templates:
1 | http://example.com/media/sample.jpg |
After following this small tutorial, you’ll be able to do this:
1 2 | {% load mytemplatetags %} {{ media_name|absolute_media_url:request }} |