Answer the question
In order to leave comments, you need to log in
How to include an image in HTML?
I’m learning Django, while studying, I came across the display of images on the site, but there is a problem: when you run the html file, everything works, the image appears, and if you call this html file using render (), then it simply is not displayed.
{%extends 'mapp/found.html'%}
{%block title%}
{{game.name}} - подробно
{%endblock%}
{%block body%}
<pre class='detailed'>
{{game.name}} - {{game.cost}} ₽
{{style}}
</pre>
<p class='main-text'>
{{game.text}}
</p>
<img src='C:\Games\mysite\images\output\2021\06\07\заду.png' alt='Картинка'>
{%endblock%}
Answer the question
In order to leave comments, you need to log in
That's it, I found the answer, the fact is that in the tag in the src attribute I simply wrote the model field that determines the address to the image, but I had to put .url after that. In short, I did everything.
Because you are running this on a server. Create a folder called static, upload images to it and use special. functions, refer to them (these functions are easily searched for by a search engine)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question