表单和模版

模版解决重复的代码,节约时间

模板文件

<br>
this is tornado templates include
<br>

子模板
{% include "05include.html" %}

include

{% include "filename" %}

include 可以导入一些其他的模块文件,一般使用include的时候,模板文件中不使用block块

导入内置模块

<br>
{% import time %}
{{ time.time()}}
导入自定义模块
<br>
{% from mod_file i,port add, upper,Calculation %}
{{add(5,6)}}




form表单
<form action="/temp" enctype="multipart/form-data" method="post">
<input type="text" name="username" />
<input type="text" name="age" />
<input type="submit" />
</form>

application配置
增加/temp路由

 

posted on 2019-04-28 16:29  python兵者  阅读(175)  评论(0)    收藏  举报