I think there is 2 method which you can do to get the work done. ...
1 : first one .. you can declare a property decorator which just return the url of that image
class Banner(BaseModel):
image = ResizedImageField(upload_to="banner", null=True, blank=True)
@property
def get_image_url(self):
return str(self.image.url).replace(" ", "")
and then you can simply access this function like normal attributes..
<div class="owl-banner owl-carousel">
{% for banner in banners %}
<div class="banner-item-01" style= --item: {{banner.get_image_url}}></div>
{% endfor %}
............................
2 Method : you can create a root path for static files as well
STATIC_URL = '/static/'
STATICFILES_DIRS = [os.path.join(BASE_DIR,'static')]
now , with this root path I can access all the file belonging to that particular folder ........
folder structure .......
* static
*Banner
*banner1.jpg
now u can simply access all the stuff ...
.banner-item-01 {
padding:300px 0px;
background-size: cover;
background-image: url('/static/Banner/banner1.jpg');
background-repeat: no-repeat;
background-position: center center;
}