Python Django uWSGI
Prerequisites
Python 3+
Installation
-
Install dependencies:
pip install ddtrace -
Initializes the Datadog tracer when your application starts:
ddtrace-run uwsgi --http :8000 --module sample_app.wsgi:application --master -p 4 --enable-threads --need-app -
Modify the application run command as follows:
# send traces to CubeAPM
DD_TRACE_AGENT_URL=http://<ip_address_of_cubeapm_server>:3130 \
DD_SERVICE=<app_name> \
# optional settings
DD_ENV=UNSET \
DD_VERSION=1.2.3 \
DD_TAGS=mykey1:myvalue1,mykey2:myvalue2 \
ddtrace-run uwsgi --http :8000 --module sample_app.wsgi:application --master -p 4 --enable-threads --need-app
Sample Application
A working example is available at https://github.com/cubeapm/sample_app_python_django_uwsgi/tree/datadog.
Troubleshooting
The following can be used for debugging:
# Print Datadog tracer startup logs on screen
DD_TRACE_STARTUP_LOGS=true
# Enable Datadog tracer debug logging if needed to see detailed logs
DD_TRACE_DEBUG=true