Skip to content

Latest commit

 

History

History
32 lines (21 loc) · 1.07 KB

ADVANCED.md

File metadata and controls

32 lines (21 loc) · 1.07 KB

Advanced Usage

Performance and Profiling

You can profile functions locally by enabling Django Silk by setting the environment variable: ENABLE_SILK to on in your .env file. If your local environment is already running, you will need to restart the web application via: docker-compose restart web

Profiling a method

Once enabled, you may use silk by decorating methods with @silk_profile. For example:

from silk.profiling.profiler import silk_profile


@silk_profile(name='View About')
def about(request):
    context = {
        'active': 'about',
        'title': 'About',
    }
    return TemplateResponse(request, 'about.html', context)

Viewing Profiling Results

You may view the profiling results by visiting: http://localhost:8000/silk

Additional Help