class UnsafeLogin(APIView):
    permission_classes = AllowAny,
authentication_classes = UnsafeSessionAuthentication,

def post(self, request, *args, **kwargs):
    username = request.DATA.get('u')
password = request.DATA.get('p')
user = authenticate(username=username, password=password)
if user is not None:
    login(request, user)
return redirect('/')
CSRF Exempt Failure - APIView csrf django rest framework