1๐
I know you can use {% static your_url %}
but I allways prefer to do like this:
I have my images in myproject/static/img/
My {{STATIC_URL}}
(settings.py variable) points to myproject/static
So in a template I usually do: <img src="{{STATIC_URL}}img/image_name.png" />
Or using an ImageField
{% for item in item_list%}
<img src="{{ item.image.url }}" />
{% endfor %}
In your case you could do:
<img src="{{ MEDIA_URL }}{{ info.personid }}.jpg" />
{{ MEDIA_URL }}
already ends with /
- You need
MEDIA_URL
to be defined in your settings.py
๐คAlvaroAV
- [Answer]-Authenticate a user on a GET API end point
- [Answer]-Render_to_response multiple args
- [Answer]-Django: updating file
Source:stackexchange.com