1
File "/home/Desktop/booklib/env/lib/python3.8/site-packages/rest_framework/authentication.py", line 126, in authenticate self.enforce_csrf(request) File "/home/Desktop/booklib/env/lib/python3.8/site-packages/rest_framework/authentication.py", line 135, in enforce_csrf check = CSRFCheck() TypeError: __init__() missing 1 required positional argument: 'get_response' [21/Dec/2021 14:37:05] "GET /api/ HTTP/1.1" 500 112898 

api/serializers.py

 from book.models import Book class BookSerializer(serializers.ModelSerializer): class Meta: model = Book fields = ('title', 'author','summary', 'isbn')``` ** Create your views here :api/views.py** ```from django.shortcuts import render from rest_framework import generics from book.models import Book from .serializers import BookSerializer class BookAPIView(generics.ListAPIView): queryset = Book.objects.all() serializer_class = BookSerializer``` **# api/urls.py** ```from django.urls import path from .views import BookAPIView urlpatterns = [ path('', BookAPIView.as_view()) ]``` 

1 Answer 1

1

I also had the same issue while upgrading to django 4.0. Upgrading rest_framework to latest version(https://github.com/encode/django-rest-framework/releases) fixed it.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.