web.py中调用文件夹内模板的方法
web.py的模板使用非常容易,但有时候我们需要做目录层级以便管理。那么如何使用目录层级的模板呢? 通常我们使用模板的时候先声明模板文件夹 复制代码 代码如下: render=web.template.render(‘templates’) 使用templates文件夹下index.html模板 复制代码 代码如下: return render.index() 使用templates文件夹下list.html模板 复制代码 代码如下: return render.list() 以上所有的html模板文件只放在tempates目录下,如果要在templates下建目录并使用目录下的模板文件只需加
下载地址
用户评论