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

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file django_simple_profiler-0.5.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_simple_profiler-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d5bae92ce6b6c9e066be68769071a43a168f58df9383ccef89e3d13ce1f8cfaf
MD5 27ad16108ef87d9c58eeadc5f102ec7a
BLAKE2b-256 4236f4344247242be3819a7d5b34d37d5d127e95d0d39815403b5836069a20a1

See more details on using hashes here.

Supported by

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