我已经阅读了其他关于在Flask中显示背景图像的问题,但是没有任何建议的解决方案适用于我,我得到了404错误(127.0.0.1 - - [22/Feb/2018 15:13:33] "GET /img/showcase.jpeg HTTP/1.1" 404 -)。我想设置为背景的jpeg图像位于静态文件夹中,名为showcase.jpeg。这是我的代码。有什么建议吗?这是我的style.css的HTML链接:
<link rel="stylesheet" type="text/css" href="{{url_for('static',filename='style.css')}}">
CSS文件:
#showcase{
background-image: url({{ url_for ('static', filename = 'showcase.jpeg') }});
height: 100vh;
background-size: cover;
background-position: center;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
padding: 0 20px;
font-weight: bold;
}