文件配置
settings = {
# 模版路劲配置
'template_path':'tpl',
# 静态路劲配置 如css 和 js
'static_path':'static',
#静态文件的前缀
'static_url_prefix':'/ssss/',
# 自定义函数配置
'ui_methods': md ,
# 自定义类配置
'ui_modules':mt,
}
html静态文件引入方法
<script href='{{ static_url("jquery-3.1.1.js")}}'></script>
传送文字
self.write("Hello, world")
传送html文件
self.render('login.html')
跳转到指定后缀
self.redirect('/margin')
for循环 - 特殊语言
{% for item in obj%}
<li>{{ item }}</li>
{% end %}
普通传参- 模版语言
{{ nvp }}
执行函数 - 模版语言
{{ func(nvp) }}
执行类 - 模版语言
{% module custom() %}
############################
{% for line in list_user %}
<tr>
XSS 跨站脚本攻击
<td>{% raw line['username'] %}</td>
<td>{{ line['email']}}</td>
</tr>
{% end %}
############################