2
を持っていない私は、このように私のview
方法があります:私は、ブラウザからhttp://localhost:8000/myapp/name/sample/を呼び出すときDjangoは: 'HttpResponseに' オブジェクトには、属性 'セッション'
def name(request, name='prabhu'):
response = HttpResponse("Name ==== %s " % name)
response.set_cookie('name',name)
response.session['name'] = name
return response
とurl
が
url(r'^name/(?P<name>[a-z\-]+)/$',views.name, name = 'name'),
ですが、私は期待していました私のセッションとクッキー[「名前」]は「サンプル」を設定します。その代わりに、'HttpResponse' object has no attribute 'session'
を与えます。クッキーは大丈夫ですが、セッションが動作していません。どこで間違ったんですか?
あなたのための私の答えの仕事をしましたか? – e4c5