I have an API created using django rest framework in a Linode server. Now, I want to check the number and the response code of each request, I want to get stats for my api. How can I do it? thankyou so much.
DRF Tracking is utilities to track requests to DRF API views, it may be good fit for you:
install: pip install drf-tracking
apply migrations: python manage.py migrate
add the following to you API views:
from rest_framework import generics
from rest_framework_tracking.mixins import LoggingMixin
class LoggingView(LoggingMixin, generics.GenericAPIView):
def get(self, request):
return Response('with logging')
There is also an other alternative Django Analytics if you want to have more than choice.