Answer the question
In order to leave comments, you need to log in
How to make images work in django?
Images from the database are not displayed, but images are added through the admin panel. I've tried everything, nothing helps. And static files are loaded. Contents of files:
models.py
image = models.ImageField("Картинка", upload_to="static/img/posts/", blank=True, null=True)
<img alt="{{ post.title }}" src="/{{ post.image.url }}">
if settings.DEBUG:
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question