主要代码如下:
def render_template(template_name,**context):
extensions=context.pop('extensions',[])
globals=context.pop("globals",{})
jinja_env=Environment(
loader= FileSystemLoader('template') ,
extensions=extensions)
jinja_env.globals.update(globals)
return jinja_env.get_template(template_name).render(context)
调用时候是这样的:
re = c.execute(sql)
persons = c.fetchall()
return render_template('person.html',persons=persons,user=user)
代码结束是这样的:
app = webapp2.WSGIApplication([('/', Myperson),], debug=True)
from bae.core.wsgi import WSGIApplication
application = WSGIApplication(app)
使用的是webapp2框架
调试的时候发现提示:
Traceback (most recent call last): File "/home/bae/instanceall/instance0/pyruntime/lib/python2.7/site-packages/webapp2.py", line 1547, in __call__ return response(environ, start_response) TypeError: 'unicode' object is not callable
搞不清楚这个'unicode' object is not callable 是什么意思,是什么地方出问题了?
我把中间的模板文件换成任意标准的HTML文件都不行,应该不是HTML文件的问题。
是不是我的参数循环有问题,还是这个JINJA的模板引擎不行?
def render_template(template_name,**context):
extensions=context.pop('extensions',[])
globals=context.pop("globals",{})
jinja_env=Environment(
loader= FileSystemLoader('template') ,
extensions=extensions)
jinja_env.globals.update(globals)
return jinja_env.get_template(template_name).render(context)
调用时候是这样的:
re = c.execute(sql)
persons = c.fetchall()
return render_template('person.html',persons=persons,user=user)
代码结束是这样的:
app = webapp2.WSGIApplication([('/', Myperson),], debug=True)
from bae.core.wsgi import WSGIApplication
application = WSGIApplication(app)
使用的是webapp2框架
调试的时候发现提示:
Traceback (most recent call last): File "/home/bae/instanceall/instance0/pyruntime/lib/python2.7/site-packages/webapp2.py", line 1547, in __call__ return response(environ, start_response) TypeError: 'unicode' object is not callable
搞不清楚这个'unicode' object is not callable 是什么意思,是什么地方出问题了?
我把中间的模板文件换成任意标准的HTML文件都不行,应该不是HTML文件的问题。
是不是我的参数循环有问题,还是这个JINJA的模板引擎不行?









