Gustavo Marinho
Gustavo Marinho

Reputation: 53

Html <img> not loading image even tougth they're in tha same directory

my code is like that:

<body>

<a href = "{% url 'pacientes' %}">
    <img src="/aaa.png"/>
</a>
</body>

my question is: Why does the image not load if the image and the html are in the same directory

obs.:

i already tried write the img tag out of the 'a' tag too. this html is part of a django project, idk if this really make difference

Upvotes: 0

Views: 59

Answers (2)

NKSM
NKSM

Reputation: 5884

Load static in your template

{% load static %}
<body>

<a href = "{% url 'pacientes' %}">
    <img src="{% static 'my_app/aaa.png' %}"/>
</a>
</body>

See also: Configuring static files

Upvotes: 1

southernegro
southernegro

Reputation: 394

Just do this:

 <img src="aaa.png"/>

Upvotes: 0

Related Questions