How to Solve NameError: name 'APIView' is not defined -- rest_framework

Solution: Import the 'APIView' module

# Add the following line to the top of your code
from rest_framework.views import APIView

 

For more information:
rest_framework APIView