第一次写- -
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)