• web.py template


    第一次写- -

    web.py的资料还是太少

    不过webpy.org的文档够多了

    不过就是没写

    $def with (var1,var2...)

    必须在第一行啊啊啊啊!

    尼玛被坑了一晚上

    import sys
    sys.path.append("..")
    
    import web
    import dao.HouseDao
    
    
    render = web.template.render('templates/')
    
    class Index:
    	def GET(self):
    		house = dao.HouseDao.get(10,0)
    		title = house.get_field('title')
    		url = house.get_field('url')
    		house = zip(title , url)
    		return render.index(house)
    

      

    $def with (hourse)
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    
    ...

    必须要这样= =,不然就是无穷的报错

    Traceback (most recent call last):
    File "E:\Python27\lib\site-packages\web\application.py", line 239, in process
    return self.handle()
    File "E:\Python27\lib\site-packages\web\application.py", line 230, in handle
    return self._delegate(fn, self.fvars, args)
    File "E:\Python27\lib\site-packages\web\application.py", line 420, in _delegate
    return handle_class(cls)
    File "E:\Python27\lib\site-packages\web\application.py", line 396, in handle_class
    return tocall(*args)
    File "E:\1957\demo\src\control\index.py", line 17, in GET
    return render.index('fyh')
    File "E:\Python27\lib\site-packages\web\template.py", line 1017, in __getattr__
    t = self._template(name)
    File "E:\Python27\lib\site-packages\web\template.py", line 1014, in _template
    return self._load_template(name)
    File "E:\Python27\lib\site-packages\web\template.py", line 999, in _load_template
    return Template(open(path).read(), filename=path, **self._keywords)
    File "E:\Python27\lib\site-packages\web\template.py", line 846, in __init__
    code = self.compile_template(text, filename)
    File "E:\Python27\lib\site-packages\web\template.py", line 912, in compile_template
    compiled_code = compile(code, filename, 'exec')
    File "templates\index.html", line 73
    def with (hourse)

    by 1957
  • 相关阅读:
    Codeforces 1237D. Balanced Playlist
    Codeforces 1237C2. Balanced Removals (Harder)
    使用excel计算指数平滑和移动平均
    HP滤波原理浅学
    第二章平稳时间序列模型——ACF和PACF和样本ACF/PACF
    第二章平稳时间序列模型——AR(p),MA(q),ARMA(p,q)模型及其平稳性
    第一章时间序列基础——差分方程和求解(二)
    R中的par()函数的参数
    你真的懂了R中的stem函数是如何绘制茎叶图的么?
    关于R中的mode()和class()的区别
  • 原文地址:https://www.cnblogs.com/x1957/p/2809376.html
Copyright © 2020-2023  润新知