The blackfire-python command is being installed along with the Blackfire
pip package. It can be used to enable the Probe automatically when a profile
is requested, without modifying your code.
No profile is triggered automatically with this command.
To ensure that your application listens to profile requests, you need
to run your webserver through blackfire-python command.
Example with Django development server:
1
blackfire-python python manage.py runserver
Example with Django using gunicorn:
1
blackfire-python gunicorn myapp.wsgi
When using monitoring with the uWSGI server, ensure that the --enable-threads
option is set. Without this, monitoring will not function correctly because
Blackfire Monitoring relies on threads to communicate with the Blackfire Agent.
To be able to run CLI commands and profile them, you need to use
blackfire-python run command:
1
blackfire-python run python my_command.py