from django.contrib.auth import logout def logout_view(request): if request.method == 'POST': logout(request) return redirect('/login.html') # Redirect to a success page.