zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    sqlhelper使用指南
    大三学长带我学习JAVA。作业1. 第1讲.Java.SE入门、JDK的下载与安装、第一个Java程序、Java程序的编译与执行 大三学长带我学习JAVA。作业1.
    pku1201 Intervals
    hdu 1364 king
    pku 3268 Silver Cow Party
    pku 3169 Layout
    hdu 2680 Choose the best route
    hdu 2983
    pku 1716 Integer Intervals
    pku 2387 Til the Cows Come Home
  • 原文地址:https://www.cnblogs.com/x1957/p/2809376.html
Copyright © 2011-2022 走看看