Our Django integration lets you instrument individual HTTP requests by adding a dedicated middleware to your application. Please note that Blackfire supports Django 1.1 and higher.
Blackfire Django middleware has compatibility issues with the Django debug toolbar. You may consider disabling the Django debug middleware when using Blackfire.
MIDDLEWARE in your Django settings. This
code is present in the
blackfire package when you install Blackfire
1 2 3 4 5
MIDDLEWARE = [ # ... 'blackfire.middleware.DjangoMiddleware' # ... ]
Then, restart your server.
The order of
MIDDLEWARE is important. You should include Blackfire as
early as possible in the list. However, it must come after any other
middleware that encodes the response’s content, such as gzip encoders.
You can use the
blackfire curl command to profile specific requests:
blackfire curl http://localhost:8000/polls/1/results