问题描述
- webpy 'builtin_function_or_method' object is not iterable
-
我准备用webpy做一个网站,现在遇到这个困难,希望知道的帮忙一下,
我的网站结构:
mysite
--site_helper.py
--controllers/index.py
--templates/main/base.html
--templates/main/index.htmlsite_helper.py
#! /usr/bin/python
#-*- coding:utf-8 -*-
#Filename: site_helper.pyimport sys
reload(sys)
sys.setdefaultencoding("utf-8")
"""这是网站的入口文件,用于调动controllers, modules, templates下的内容来服务"""
import web
urls = (
'/?', 'controllers.index.Index', #controllers/index.py
)#加载render
render = web.template.render
main_render = render(loc='templates/main', base='base', globals=globals)if name == '__main__':
app = web.application(urls, globals())
app.run()templates/main/base.html
$def with(page)title
<br>
#menu{<br>
width:200px;<br>
float:right;<br>
}<br>$:page
templates/main/index.html
$def with(news)test
news
$news
controllers/index.py
#! /usr/bin/python
#-*- coding:utf-8 -*-
#Filename: controllers/index.pyimport sys
reload(sys)
sys.setdefaultencoding("utf-8")import site_helper as sher
class Index():
def GET(self):
ss = 'hello news'
return sher.main_render.index(ss) #出错在我标记出错的那行产生了错误,错误为:'builtin_function_or_method' object is not iterable