在Flask中:如何将子模板中的变量包含到父模板中?

2024-09-28 21:57:16 发布

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

我想把实验室也包括进来_莫伊斯.html进入实验室_临时html. 但当我做这个实验的时候,实验室_临时文件不能显示实验室的变量_莫伊斯.html. 在

这是实验室_莫伊斯.html,可变mois:

<html>
</head>
  <body>
    <div class="container">
      <div class="row">
        <div class="two-third column" style="margin-top: 5%">
            <h1>Moisture in Rockwool: {{"{0:0.1f}".format(mois)}}%</h1>
        </div>
      </div>
    </div>
  </body>
</html>

这是实验室的输出_莫伊斯.html它本身

enter image description here

这是实验室_临时html使用{%include'lab_莫伊斯.html'%}:

^{pr2}$

但输出是这个(注意岩棉中的水分没有价值):

enter image description here

我怎样才能让MOI的价值出现在实验室里_temp.html?在


Tags: divstylecontainerhtmlbodycolumnh1实验室