Skip to main content

Django simple profiler it is a useful tool for Django framework that allows you to profile your views.

Project description

Django simple profiler

Django simple profiler it is a useful tool for Django framework that allows you to profiling your views.

Example of use:

  • decorate your views
  • use as context manager

Requires DEBUG=True in settings.py (!)

https://github.com/Sobolev5/django-simple-profiler

How to install it

To install run:

pip install django-simple-profiler

example.py

from django_simple_profiler import django_profiler # as decorator
from django_simple_profiler import django_profiler_full # as decorator with full queries
from django_simple_profiler import DjangoProfiler # as context manager


@django_profiler
def get_countries(request):
    for country in Country.objects.all():
        print(country)
    return HttpResponse("OK")

@django_profiler_full
def get_countries(request):
    for country in Country.objects.all():
        print(country)
    return HttpResponse("OK")

def get_countries(request):

    # simple
    with DjangoProfiler() as dp: 
        for country in Country.objects.all():
            print(country)

    # full queries
    with DjangoProfiler(full=True) as dp:
        for country in Country.objects.all():
            print(country)

    # with label
    with DjangoProfiler(label="ActiveCountries") as dp:
        for country in Country.objects.filter(active=True):
            print(country)

    # with label and full queries
    with DjangoProfiler(label="ActiveCountries", full=True) as dp:
        for country in Country.objects.filter(active=True):
            print(country)

    return HttpResponse("OK")

P.S.

Try my free service for developers Workhours.space. It's time tracker with simple interface, powerful functionality such as automatic payroll calculation, telegram bot timer, easy web2 and web3 auth and more. Enjoy.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

django_simple_profiler-0.5.1-py3-none-any.whl (4.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page