python - How to load the uploaded image in the -
in database, banner table's url field value this:uploads/images/banner.jpg.
so, in template:
{% ban in data.banner %} <li><img src="{{ ban.img }}" alt="" ></li> {% endfor %} the result in browser below:
<img src="uploads/images/banner.jpg" alt="" draggable="false"> so, did not load image under project.
how can load relative path images ?
you should use static template tag:
{% load staticfiles %} <li><img src="{% static ban.img %}" alt="" ></li> hope helps!
Comments
Post a Comment