簡體   English   中英

Flask和CSS對靜態文件的引用

[英]Flask and css reference to static files

我有一個基本的燒瓶應用程序,在其中我像這樣在css文件中引用背景圖像

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

我的文件夾組織是這樣的:

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

如何獲取CSS以正確調用圖像?

將您的css更改為此,然后再試一次:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM