Analysing Django requests

Kolo can be used to analyse the request/response cycle of your Django project.

KoloMiddleware

When using python manage.py runserver, the best approach is to add KoloMiddleware to the top of your MIDDLEWARE setting:

MIDDLEWARE = [
    "kolo.middleware.KoloMiddleware",
    ...
]

This will generate a trace starting when a request reaches KoloMiddleware and ending when the response reaches KoloMiddleware.

This will also generate a trace for each request generated by Django’s test client.

Warning

You can also use kolo run, but the autoloading functionality of manage.py runserver uses subprocesses, which Kolo can’t automatically trace. You can work around this by running kolo run manage.py runserver --noreload --nothreading.