My Django webapp lets users download text files that are generated on the fly:
response = HttpResponse(my_file_contents)
response['Content-Disposition'] = 'attachment; filename="my file.txt"'
return response
I installed Django Debug Toolbar (0.11.0, since I cannot get 1.0.1 to work), but when I click to make the download, the toolbar doesn't show info about the file that was downloaded, presumably because that is a separate page/request (or maybe because it's a non-HTML file). The downloaded file doesn't contain any debug info either.
How can I profile the performance of this file download?
You are right, this is one of the cases where the Debug Toolbar cannot help you. I would recommend using log files to time your request times. For instance, if you are using Nginx then you can use its syntax for adding extra information to log files. For instance the following line adds the response time for each request:
log_format timed_combined '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" '
'$request_time $upstream_response_time $gzip_ratio';
If you prefer a Django app solution, you can check out django-timelog.