def myview(request):
item = Item.objects.all().count()
if not request.COOKIES.get('mycookie', None):
response.set_cookie('mycookie', item)
n = request.COOKIES.get('mycookie')
return render_to_response('index.html', {'n': n}, context_instance=RequestContext(request))
似乎我的 cookie 没有保存。我究竟做错了什么?