Setting a cookie in flask

Viewed 14999

I am trying to create a cookie in flask. The partial example in the manual is:

resp = make_response(render_template(...))
resp.set_cookie(’username’, ’the username’)

So I implement it as:

resp = render_template('show_entries.html', AO_sInteger = session.get('AO_sInteger'))
resp.set_cookie('AO_sInteger', AO_sInteger)

The system then returns this error:

File "...\Flaskr101.py", line 19, in add_entry
resp.set_cookie('AO_sInteger', AO_sInteger)
AttributeError: 'unicode' object has no attribute 'set_cookie'

How can I fix this problem?

1 Answers
Related