我想在烧瓶里做个饼干。手册中的部分示例如下:
resp = make_response(render_template(...))
resp.set_cookie(’username’, ’the username’)
所以我把它当作
resp = render_template('show_entries.html', AO_sInteger = session.get('AO_sInteger'))
resp.set_cookie('AO_sInteger', AO_sInteger)
然后系统返回错误:
File "...\Flaskr101.py", line 19, in add_entry
resp.set_cookie('AO_sInteger', AO_sInteger)
AttributeError: 'unicode' object has no attribute 'set_cookie'
我怎样才能解决这个问题?
在手册中resp是:
在你的代码中是:
使用
make_response
使其成为正确的响应对象:相关问题 更多 >
编程相关推荐