RusEu / drf-profiling-mixins

Django Rest Framework Profiling

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Django Rest Framework Profiling Mixins

Usage

from rest_framework import viewsets

class MyViewSetViewSet(ProfilingMixin, viewsets.ModelViewSet):
    queryset = MyModel.objects.all()
    serializer = MySerializer

In the response you will get an extra __meta__ field containing usefull information for profiling.

    "__meta__": {
        "templating": {
            "rendering_time": 0.04318714141845703
        },
        "database": {
            "execution_time": 0.010000000000000002,
            "queries_count": 10
        }
    }

About

Django Rest Framework Profiling


Languages

Language:Python 100.0%