Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flask and css reference to static files

I have a basic flask app, where I reference background images in my css file like this

.three {
  background:url('/static/images/house.jpg');
}

My folder organization is like this:

project
    app.py
    -static
        -images
            house.jpg
        -css
            index.css
    -templates
        index.html

How do I get my css to properly call the image?

like image 569
Rob Avatar asked Dec 29 '25 20:12

Rob


1 Answers

change your css to this, and then try again:

.three {
  background-image: url('images/house.jpg');
}
like image 177
lord63. j Avatar answered Jan 01 '26 12:01

lord63. j



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!