'Expected a `Response`, `HttpResponse` or `HttpStreamingResponse` to be returned from the view, but received a `<class 'NoneType'>` DRF

I am receiving the error

Expected a Response, HttpResponse or HttpStreamingResponse to be returned from the view, but received a <class 'NoneType'> In Django DRF,

in my query i am trying to get the count of all related items to one specific item

the views.py

@api_view(['GET'])
def getVesselInfo(request):
    vessels = (Vessel.objects.annotate(
        Count('vessel_components', distinct=True)))
    vSerializer = VesselSerializer(vessels, many=True)
    return Response(vSerializer.data,)

models.py:

class Vessel(models.Model):
    name = models.CharField(max_length=255)
    imo = models.CharField(max_length=255)

    def __str__(self):
        return self.name

class Component(MP_Node):
    name = models.CharField(max_length=255, blank=True, null=True)
    manufacturer = models.CharField(max_length=200, blank=True, null=True)
    model = models.CharField(max_length=200, blank=True, null=True)
    type = models.CharField(max_length=200, blank=True, null=True)
    remarks = models.TextField(blank=True, null=True)
    vessel = models.ForeignKey(
        Vessel, blank=True, null=True, on_delete=models.CASCADE, related_name='vessel_components')

    def __str__(self):
        return self.name


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source