Also, if the first image of this expression is an instance of a model, and the second image is the name of the field, then you generally want to use the url attribute of that field to produce the proper reference url. (e.g., {{ image.image.url }}
Url is correct because I used relationship between two models (post and image)
here is models.py
from django.db import models
# Create your models here.
class Post(models.Model):
title = models.TextField()
description = models.TextField()
class Image(models.Model):
post = models.ForeignKey(Post, on_delete=models.CASCADE)
image = models.ImageField(upload_to='content/static/images/')
My bad! Just my English skills… I checked it in console of browser and image paths actually are correct just “active” class does not display, I can not understand why. and items divs in console log are grey colored
I do not have MEDIA_URL instead I have STATIC_URL : STATIC_URL = 'content/static/'
and I am sorry, I did not mention that images display when I don’t have an carousel but when I try to display they in carousel this code is grey in console and this code does not display in browser page:
If these are uploaded files, then you should have a MEDIA_URL so that your web server knows how to retrieve them.
If they’re uploaded files, they’re not static files. This is not an “instead of” situation, it’s an “in addition to” situation.
Static files are a completely separate topic from media files. They are not the same and should not be managed the same. You do not work with them the same way.