我想知道auth.logout是否清除会话数据,或者我必须自己做。
from django.contrib.auth.decorators import login_required
from django.contrib import auth
@login_required
def logout(request):
auth.logout(request)
return redirect('base:homepage')
像这样的东西...
from django.contrib.auth.decorators import login_required
from django.contrib import auth
@login_required
def logout(request):
for sesskey in request.session.keys():
del request.session[sesskey]
auth.logout(request)
return redirect('base:homepage')
谢谢!