Не удается загрузить HTML-изображение на веб-сайт, однако URL локального файла работает нормально

прежде чем говорить, что это дубликат, пожалуйста, прочитайте всю статью.

У меня есть следующий кусок кода:

<title>the-doge.net</title>

<!-- add the image-->
<img src="doge-poster1.png" height="500" width="800" style="display: block; margin-left: auto; margin-right: auto;"/>

<body style="background-color:black;">

<!--add the login and register buttons-->
<input type="image" src="register.png" style="display:inline; position:absolute; top:50px; right: 7%;"/>
<input type="image" src="login.png" style="display:inline; position:absolute; top:50px; left: 12%;"/>

</body>

однако, там написано

Not Found: /login.png
Not Found: /doge-poster1.png
Not Found: /register.png

Я просмотрел различные ответы на Stack Overflow, включая this, а также несколько сайтов, таких как here и предоставил полный каталог, и изображение на img.bb, но все это не сработало. Вот моя структура файлов:

...
landing(folder)
--migrations (folder)
--templates (folder)
----landing (folder)
------base.html
------doge-poster1.png
------index.html
------login.png
------navbar.html
------register.png

примечание: В PyCharm есть способ открыть URL локального файла, и он работает нормально, но python manage.py runserver, похоже, не отображает ни одного изображения.

Я не уверен, но вы можете попробовать так?

<title>the-doge.net</title>

<!-- add the image-->
<img src="./doge-poster1.png" height="500" width="800" style="display: block; margin-left: auto; margin-right: auto;"/>

<body style="background-color:black;">

<!--add the login and register buttons-->
<input type="image" src="./register.png" style="display:inline; position:absolute; top:50px; right: 7%;"/>
<input type="image" src="./login.png" style="display:inline; position:absolute; top:50px; left: 12%;"/>

</body>

Или вы можете попробовать следующим образом

<title>the-doge.net</title>

<!-- add the image-->
<img src="/templates/landing/doge-poster1.png" height="500" width="800" style="display: block; margin-left: auto; margin-right: auto;"/>

<body style="background-color:black;">

<!--add the login and register buttons-->
<input type="image" src="/templates/landing/register.png" style="display:inline; position:absolute; top:50px; right: 7%;"/>
<input type="image" src="/templates/landing/login.png" style="display:inline; position:absolute; top:50px; left: 12%;"/>

</body>
Вернуться на верх