Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/363.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Jinja2模板-CSS不工作_Python_Css_Pandas_Jinja2 - Fatal编程技术网

Python Jinja2模板-CSS不工作

Python Jinja2模板-CSS不工作,python,css,pandas,jinja2,Python,Css,Pandas,Jinja2,我有一个Python项目,它具有以下文件结构 days_on_hand.py templates\ doh_managers.html static\ style.css 以下是我的html模板代码: <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <link rel= "stylesheet" type= "text/css

我有一个Python项目,它具有以下文件结构

 days_on_hand.py
 templates\
    doh_managers.html
 static\
    style.css
以下是我的html模板代码:

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <link rel= "stylesheet" type= "text/css" href= "/static/style.css">
    <title>{{ title }}</title>
</head>
<body>
    <h2>Days Inventory on Hand -- Warehouse</h2>
     {{ managers_days }}
</body>
</html>
我没有在我的输出中看到任何css格式,这是使用以下方法生成的:

template_vars = {"title": "Days Inventory on Hand -- Warehouse",
                             "managers_days": df.to_html(index=False)}
html_out = template.render(template_vars)
html_file.write(html_out)
我看到了表格上的双边框,我的css如下,应该折叠边框,而且H2文本没有居中显示:

h2{
    text-align: center;
}

table {
    border-collapse: collapse;
}

如果您的
style.css
文件位于项目的
static
文件夹中,那么要通过WSGI提供资源,您必须在样式表的
href
中使用。

请提供您看到的内容和期望的内容。我是从这开始的,但仍然没有得到预期的结果
h2{
    text-align: center;
}

table {
    border-collapse: collapse;
}