There are few things you need to ensure are set.
The main important one is adding the following env flags before your run your application.
In your .env add:
SILKY_PYTHON_PROFILER=True
If you do have SILKY_INTERCEPT_FUNC method in your settings.py ensure it returns the correct boolean value based on the request e.g.
def SILKY_INTERCEPT_FUNC(request):
"""log only session has recording enabled."""
return 'record_requests' in request.session
In addition, ensure you add the silk middleware in the correct order
In settings.py add the following:
MIDDLEWARE = [
...
'silk.middleware.SilkyMiddleware',
...
]
INSTALLED_APPS = (
...
'silk'
)
Note: The middleware placement is sensitive. If the middleware before silk.middleware.SilkyMiddleware returns from process_request then SilkyMiddleware will never get the chance to execute. Therefore you must ensure that any middleware placed before never returns anything from process_request. See the django docs for more information on this.
Ref: https://github.com/jazzband/django-silk#installation