Rob
Rob

Reputation: 3459

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?

Upvotes: 3

Views: 1735

Answers (1)

lord63. j
lord63. j

Reputation: 4670

change your css to this, and then try again:

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

Upvotes: 1

Related Questions