Skip to main content

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.

Metadata

Release files for django-simple-profiler 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for django-simple-profiler 0.5.1
File Interpreter ABI Platform Actions
django_simple_profiler-0.5.1-py3-none-any.whl Python 3 none any Details for django_simple_profiler-0.5.1-py3-none-any.whl

Release files / django_simple_profiler-0.5.1-py3-none-any.whl

Download URL django_simple_profiler-0.5.1-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d5bae92ce6b6c9e066be68769071a43a168f58df9383ccef89e3d13ce1f8cfaf
BLAKE2b-256 checksum
How to use checksums
4236f4344247242be3819a7d5b34d37d5d127e95d0d39815403b5836069a20a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.2

Security for django-simple-profiler 0.5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page