The bottom line is that it just rebooted. It may not be enough to post it, but I thought that I might be addicted to this kind of place unexpectedly.
In django, I made an app called posts
in a project called myblogapp
.
At this time, I added a new static
file and tried to load the image.
myblogapp └posts ├ templates | └ posts | └ index.html | ├ static ⏋ | └ posts | ← Make here | └ home.html ⏌ | | (Others such as views.py are omitted)
In ʻindex.html`
{% load static %}
<img src="{% static 'posts/home.jpg' %}" alt="home image">
It was when I tried to display the image by writing.
The image is not displayed even though it is specified correctly Just a mark indicating that there is no image and the word "home image" are displayed. The image did not load correctly.
Looking at the display on the shell running django
[(Date and time)] "GET /static/posts/home.jpg HTTP/1.1" 404 1668
Is displayed and 404 is returned. You can see that the existence of the file is not recognized.
I stopped django's server once, and then ran python manage.py runserver
again and it loaded normally.
(Correctly, stop the server once and run python manage.py findstatic .
Make sure the static
directory is recognized properly
I ran python manage.py runserver
. )
Any program If it doesn't work, you should restart it for the time being. I realized it again ...