• 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
  • 相关阅读:
    BottomNavigationView3个项以上不显示文字的问题
    ViewPager中height=wrap_content无效,ScrollView里边用ListView显示不全解决办法
    Gson解析
    Parcelable Android SDK提供,基于内存,读写高于硬盘
    Serializable序列化 && 坑
    OpenStack中添加Floating IP
    Hadoop
    Redis
    ELK
    OpenStack
  • 原文地址:https://www.cnblogs.com/x1957/p/2809376.html
Copyright © 2020-2023  润新知