Show request duration in drf-spectacular (Swagger)

435 Views Asked by At

I have a Django/DRF project with drf-spectacular (Swagger) integration and wondering how can I add a request duration as shown on the image below. Is there any way to achive elapsed time section? Thanks in advance.

enter image description here

1

There are 1 best solutions below

3
Insa On BEST ANSWER

That is a Swagger-UI feature independent of drf-spectacular. To pass it through simply set the setting like so:


SPECTACULAR_SETTINGS = {
    "SWAGGER_UI_SETTINGS": {
        "displayRequestDuration": True,
        # other swagger settings
    },
    # other spectcular settings
}

other swagger settings can be found here