I\'d like to use an image file as a background-image on Django
. But I do not know how.
First, I read this and tried to write like following this in a css file.
For some reasons, which I cannot explain the accepted answer did not worked out for me. (I wanted to use a picture as a cover image for the whole body).
However, here is the alternative that has worked for me for anyone that might be useful for someone that will come across.
In a css file, which is located in the static file directory, I have wrote the following:
CSS:
body {
background: url(../main/img/picture-name.jpg);
}
You do not have to include *'{% load static %}'*
in your css file.
HTML:
include {%load static%}
at the top
create a link href to style, as below.