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.
Here is the structure of directories for my project so you can be in context of why i'm using the URL's i am using and so you can adapt it to your project. Root directory is the folder than contains the project and apps. I have 4 apps (contacto, galeria, inicio, mapa) and the "WebCalistenia" which is the folder generated when you create a project. There i have static folder with a child called as the father ("WebCalistenia") which has two childs "/css" and "/img"
enter image description here
This is what worked for me. Firstly you have to {% load static %} on your HTML.
{% load static %}
...
Now you'll link the CSS to HTML
Finally on the css file you will write:
background: url("../img/image_name.jpeg");