---
title: Troubleshooting Python App and API Protection
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Datadog Security > App and API Protection > Enabling App and API
  Protection > Enabling App and API Protection for Python > Troubleshooting
  Python App and API Protection
---

# Troubleshooting Python App and API Protection

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com

{% alert level="danger" %}
This product is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site). ().
{% /alert %}

{% /callout %}

## Common Issues{% #common-issues %}

### No security signals appearing{% #no-security-signals-appearing %}

1. **Verify Agent version**

   - Ensure you're running Datadog Agent v7.41.1 or higher
   - Check Agent status: `datadog-agent status`

1. **Check Python tracer version**

   - Confirm you're using Python tracer v2.21 or a recent version on v3.0.0
   - Check version: `python -c "import ddtrace; print(ddtrace.__version__)"`

1. **Verify environment variables**

   - Ensure `DD_APPSEC_ENABLED=true` is set
   - Check `DD_SERVICE` and `DD_ENV` are properly configured
   - Verify `DD_APM_ENABLED=true` if using APM features

### Application fails to start{% #application-fails-to-start %}

1. **Check ddtrace installation**

   - Verify ddtrace is installed: `pip show ddtrace`
   - Install with security extras: `pip install ddtrace`

1. **Import errors**

   - Ensure all required dependencies are installed
   - Check for conflicting packages

1. **Environment variable issues**

   - Verify environment variables are set correctly
   - Check for typos in variable names

### Service not identified{% #service-not-identified %}

**Symptoms:** Service appears as "unnamed-service" in Datadog

**Solution:** Set the `DD_SERVICE` environment variable:

```bash
export DD_SERVICE=your-service-name
export DD_ENV=your-environment
ddtrace-run python app.py
```

### Permission issues{% #permission-issues %}

**Symptoms:** Application fails to start or AAP doesn't work

**Solution:** Ensure proper file permissions and that the application can write to `/tmp`:

```bash
chmod 755 /path/to/your/app
```

### Framework not supported{% #framework-not-supported %}

**Symptoms:** AAP works but some features are missing

**Solution:** Check the [compatibility guide](https://docs.datadoghq.com/security/application_security/setup/python/compatibility) for supported frameworks and versions.

## Debug Mode{% #debug-mode %}

Enable debug logging to get more information:

```bash
export DD_TRACE_DEBUG=true
export DD_APPSEC_ENABLED=true
ddtrace-run python app.py
```

### Still having issues?{% #still-having-issues %}

If you're still experiencing problems:

1. Check the [Application Security Monitoring troubleshooting guide](https://docs.datadoghq.com/security/application_security/troubleshooting)
1. Review the [Python tracer documentation](https://docs.datadoghq.com/tracing/trace_collection/compatibility/python)
1. Contact [Datadog support](https://docs.datadoghq.com/help)

## Further Reading{% #further-reading %}

- [How App and API Protection Works](https://docs.datadoghq.com/security/application_security/how-it-works/)
- [OOTB App and API Protection Rules](https://docs.datadoghq.com/security/default_rules/?category=cat-application-security)
- [Troubleshooting App and API Protection](https://docs.datadoghq.com/security/application_security/troubleshooting)
