瓶子没有在我的web服务器的css文件中获取背景图像

2024-10-01 22:39:01 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在用瓶子和python创建一个web服务器,我可以检索所有内容,但我不能设置背景图像

代码:

*css*
body {

background-image: url("/img/banner.jpg") no-repeat center center fixed;
background-size: cover;
font-family: Quicksand-Bold;
src: url("fonts/Quicksand-Bold") format("opentype");
}

*bottle*
@route('/img/<filename>')
def estilo (filename):
return static_file(filename, root='./views/img')

我不得不说,从htmls调用的图像工作得很好,但是css内部的图像工作得不好。我必须用另一种方式写吗

多谢各位

层次结构如下:我在根目录中有一个de-瓶子文件,然后是一个视图文件夹,其中包含所有html,然后是css/js/img文件夹,其中包含尊重


Tags: 图像服务器文件夹weburl瓶子内容img

热门问题