Answer the question
In order to leave comments, you need to log in
How to insert MEDIA_URL in Django template?
Can you please tell me how to insert a link to a file in the template? If I go directly through the browser using the link 127.0.0.1:8000/media/images/img.jpg then the image opens.
Tried it didn't work
<img src="{{ MEDIA_URL }}/images/img.jpg" alt="..." class="img-circle profile_img">
Answer the question
In order to leave comments, you need to log in
static - content related to the framework and what is written on it
https://docs.djangoproject.com/en/1.9/howto/static...
{% load staticfiles %}
<img src="{% static "my_app/myexample.jpg" %}" alt="My image"/>
{{ mymodel.my_image_field.url }}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question