Flask6:模板的基本使用 (render_template)

基本使用:

  1. 模板文件就是html文件,需要放在templates文件夹中。当然也可以在Flask(name,template_folder)来修改模板地址,但不推荐
  2. 通过render_template来渲染模板
  3. 传变量到模板中,可以把变量定义成字典,然后在render_template中,通过关键词参数的方式传递过去,render_template(’ ',**context)
    Flask6:模板的基本使用 (render_template)
    返回渲染的模板后,可以在模板中用该字典中变量,通过{{ key }}
    Flask6:模板的基本使用 (render_template)
上一篇:YOLOX 模型转换报错 [TensorRT] ERROR: runtime.cpp (25) - Cuda Error in allocate: 2 (out of memory)


下一篇:Redis Cluster配置信息注释