Hello I am trying to get my NavBar on bootstrap to show a Logo, I have tried moving the png to different folders in the app but I get this error:
System check identified no issues (0 silenced).
January 21, 2022 - 18:18:54
Django version 4.0.1, using settings 'mapproject.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
[21/Jan/2022 18:19:00] "GET / HTTP/1.1" 200 229230
Not Found: /logo.png
[21/Jan/2022 18:19:00] "GET /logo.png HTTP/1.1" 404 2219
Here is the index.html:
<!--Navbar-->
<!-- Just an image -->
<!-- Image and text -->
<nav class="navbar navbar-dark bg-dark">
<a class="navbar-brand" href="#"">
<img src="logo.png" width="30" height="30" class="d-inline-block align-top" alt=""/>
EtherWAN Product Map
</a>
</nav>
<!--End Navbar-->
"static" folders are needed in Django like in flask. https://docs.djangoproject.com/en/4.0/howto/static-files/
put your image in the static folder and call: static/logo.png instead of logo.png .
file structure:
HTML File Code Example:
{% load static %}
{% block content %}
<!--Navbar-->
<!-- Just an image -->
<!-- Image and text -->
<nav class="navbar navbar-dark bg-dark">
<a class="navbar-brand" href="#"">
<img src="{% static 'posts/images/logo.png' %}" width="30" height="30" class="d-inline-block align-top" alt=""/>
EtherWAN Product Map
</a>
</nav>
<!--End Navbar-->
{% endblock content %}
the file structure can be mainapp/ -> static/ -> images/ logo.png
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.