I am currently trying to figure out why I get a 404 Error (not found). I have uploaded the ImageField of my Model to the static file 'article_img'. But when I want to show the stored image on the html site, the resource cannot be found.
What is the reason for that?
from django.db import models
from django.utils.translation import gettext_lazy as _
class Article(models.Model):
group = models.ForeignKey(Group, on_delete=models.SET_NULL, verbose_name=_('group'), null=True)
name = models.CharField(_('name'), max_length=200)
image = models.ImageField(_('image'), upload_to='./static/lagerverwaltung/article_img/', blank=True, null=True)
<div id="article_img_div">
{% load static %}
{% if article.image %}
<img class="article_img" type="image" src="{{ article.image.url }}" alt="{% static 'lagerverwaltung/article_img/none.jpg' %}">
{% endif %}
</div>