I am trying to add a background image to a simple site I am trying to make, but get a 404 error on the image and no background when I try to use the local jpg file I downloaded. However when I use a link from an image on the web the image appears correctly.
Here is my file structure for the code:
website/
run.py
project/
__init__.py
routes/
home.py
templates/
layout.html
homepage.html
img/
image.jpg
Here is the code I am trying to run to get the image to show as the background in homepage.html:
<head>
<title>Welcome!</title>
<style type="text/css">
body{
background-image: url('/img/image.jpg');
min-height: 100%;
background-size:100%
}
</style>
</head>
I have tried all these variations on the url but none have worked for displaying the background:
background-image: url('/img/image.jpg');
background-image: url("/img/image.jpg");
background-image: url(/img/image.jpg);
background-image: url('/website/project/templates/img/image.jpg');
background-image: url("/website/project/templates/img/image.jpg");
background-image: url(/website/project/templates/img/image.jpg);
background-image: url('project/templates/img/image.jpg');
background-image: url("project/templates/img/image.jpg");
background-image: url(/project/templates/img/image.jpg);
And pretty much every other combination of that filepath and quote options. I've even put in the filepath starting from my root directory, file:///Users/kyle/Desktop/programming/website/project/templates/img/image.jpg. This displays the image if I copy and paste it into my browser but not if I put it in the url field of the background image.
Keeping all the code the same, any image whose link I take from google works however but I would like to get a local image working if possible.