# Disable Django APM agent

**URL:** <https://discuss.elastic.co/t/disable-django-apm-agent/233903>\
**Category:** APM\
**Tags:** python\
**Created:** [May 22, 2020, 12:52pm UTC](https://discuss.elastic.co/t/disable-django-apm-agent/233903 "2020-05-22T12:52:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Taras\_Slyvka](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/taras_slyvka/32/66966_2.png) [@Taras\_Slyvka](https://discuss.elastic.co/u/Taras_Slyvka)\
**Post date:** [May 22, 2020, 12:52pm UTC](https://discuss.elastic.co/t/disable-django-apm-agent/233903/1 "2020-05-22T12:52:23Z")

</div>

If you are asking about a problem you are experiencing, please use the following template, as it will help us help you. If you have a different problem, please delete all of this text 🙂

**Kibana version** : 7.6

**Elasticsearch version** : 7.6

**APM Server version** : 7.6

**APM Agent language and version** : python, elastic-apm==5.5.2

**Browser version** : Google Chrome , Version 81.0.4044.138

**Original install method (e.g. download page, yum, deb, from source, etc.) and version**:

- elastic by docker, [https://www.elastic.co/guide/en/apm/get-started/current/quick-start-overview.html](https://www.elastic.co/guide/en/apm/get-started/current/quick-start-overview.html)
- agent by pip  
**Fresh install or upgraded from other version?**
- fresh

Django project that run in different environments (prod, staging, test, local). I want to disable APM agent in some envs.

- `ELASTIC_APM['DISABLE_SEND'] = True` - doesn't help. Still receive `"response_code": 401, "error": "unauthorized"` errors in APM server.
- `ELASTIC_APM['ENABLED'] = False` - (found this somewhere) - doesn't help too
- `ELASTIC_APM['SERVER_URL'] = ''` - not sure that its good idea, as agent still operate (probably).

What is the proper way to disable APM python agent?

---

<div class="post-metadata">

**Author:** ![basepi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/basepi/32/53056_2.png) [@basepi](https://discuss.elastic.co/u/basepi)\
**Post date:** [May 26, 2020, 10:49pm UTC](https://discuss.elastic.co/t/disable-django-apm-agent/233903/2 "2020-05-26T22:49:23Z")

</div>

Welcome @Taras_Slyvka!

The easiest way to completely disable the agent is actually one that you tried:

> [@Taras\_Slyvka](#):
>
> `ELASTIC_APM['ENABLED'] = False` - (found this somewhere) - doesn't help too

This was introduced in v5.6.0. If you upgrade, it should work!

Hope that helps!

---

<div class="post-metadata">

**Author:** ![Taras\_Slyvka](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/taras_slyvka/32/66966_2.png) [@Taras\_Slyvka](https://discuss.elastic.co/u/Taras_Slyvka)\
**Post date:** [May 28, 2020, 10:07am UTC](https://discuss.elastic.co/t/disable-django-apm-agent/233903/3 "2020-05-28T10:07:22Z")

</div>

> [@Taras\_Slyvka](#):
>
> ELASTIC\_APM['DISABLE\_SEND'] = True

Thank you for this response.

Should I use `ELASTIC_APM['ENABLED'] = False` in combination with `ELASTIC_APM['DISABLE_SEND'] = True`?

In case when only one flag being used `ELASTIC_APM['ENABLED'] = False` - there is trying to send data in the case when an error happens.

Thanks, Taras.

---

<div class="post-metadata">

**Author:** ![basepi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/basepi/32/53056_2.png) [@basepi](https://discuss.elastic.co/u/basepi)\
**Post date:** [May 28, 2020, 3:25pm UTC](https://discuss.elastic.co/t/disable-django-apm-agent/233903/4 "2020-05-28T15:25:41Z")

</div>

If you're on 5.6.0 and `ENABLED` is False, there should be no data sent by the agent. If you're still seeing agent activity, it's a bug, and we'd love to help solve it. Can you open an issue [here](https://github.com/elastic/apm-agent-python/issues/new?template=Bug_report.md)?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 18, 2020, 11:25am UTC](https://discuss.elastic.co/t/disable-django-apm-agent/233903/5 "2020-06-18T11:25:53Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
