# Async

**URL:** https://forum.djangoproject.com/c/internals/async/8.md

[Latest](https://forum.djangoproject.com/latest.md) · [Categories](https://forum.djangoproject.com/categories.md) · [Tags](https://forum.djangoproject.com/tags.md)

---

## [Are database connections still async\_unsafe?](https://forum.djangoproject.com/t/are-database-connections-still-async-unsafe/45892)

<div class="topic-metadata">

**Author:** [@ryanking13](https://forum.djangoproject.com/u/ryanking13)\
**Replies:** 6\
**Last updated:** [August 29, 2026, 5:26am UTC](https://forum.djangoproject.com/t/are-database-connections-still-async-unsafe/45892 "2026-08-29T05:26:28Z")

</div>

Hi, I recently enjoyed listening to Carlton Gibson’s Django’s Async Story podcast, and exploring the Django’s async feature. One thing I noticed is that accessing database (using ORM’s etc) is still marked as @async\_uns…

---

## [Async Django ORM (django-async-backend)](https://forum.djangoproject.com/t/async-django-orm-django-async-backend/45888)

<div class="topic-metadata">

**Author:** [@Arfey](https://forum.djangoproject.com/u/Arfey)\
**Replies:** 0\
**Last updated:** [August 28, 2026, 12:38am UTC](https://forum.djangoproject.com/t/async-django-orm-django-async-backend/45888 "2026-08-28T00:38:40Z")

</div>

The result of long and hard work on django-async-backend :relieved\_face: What did we get? What didn’t we get? What problems do we have, and where is this going? Short context Django has several PRs trying to implement…

---

## [sync\_to\_async() called 14 times with default Django middleware, and 2 times with no middleware](https://forum.djangoproject.com/t/sync-to-async-called-14-times-with-default-django-middleware-and-2-times-with-no-middleware/31701)

<div class="topic-metadata">

**Author:** [@rob4226](https://forum.djangoproject.com/u/rob4226)\
**Replies:** 3\
**Last updated:** [June 19, 2026, 10:42pm UTC](https://forum.djangoproject.com/t/sync-to-async-called-14-times-with-default-django-middleware-and-2-times-with-no-middleware/31701 "2026-06-19T22:42:54Z")

</div>

Hello, I have a production Django DRF (django-rest-framework) server application that has one endpoint that would benefit greatly from being async due to making external HTTP requests in the View. I decided on breaking …

---

## [Building a modern async authentication library for Django](https://forum.djangoproject.com/t/building-a-modern-async-authentication-library-for-django/45294)

<div class="topic-metadata">

**Author:** [@ehs22n](https://forum.djangoproject.com/u/ehs22n)\
**Replies:** 0\
**Last updated:** [June 13, 2026, 8:37pm UTC](https://forum.djangoproject.com/t/building-a-modern-async-authentication-library-for-django/45294 "2026-06-13T20:37:35Z")

</div>

Hello Django community Over the last few months I’ve been building a project called CipherToken, a Rust-powered authentication and cryptography library for Python built with PyO3. GitHub: Documentation: CipherTok…

---

## [need input for async redis backend](https://forum.djangoproject.com/t/need-input-for-async-redis-backend/38426)

<div class="topic-metadata">

**Author:** [@amirreza8002](https://forum.djangoproject.com/u/amirreza8002)\
**Replies:** 23\
**Last updated:** [May 27, 2026, 11:17pm UTC](https://forum.djangoproject.com/t/need-input-for-async-redis-backend/38426 "2026-05-27T23:17:50Z")

</div>

hi, so 33573 ticket has an owner, but seems inactive, so i wanted to takeover but, there seems to have been some unresolved conversation on how the backend should be implemented, and since there doesn’t seem to be any a…

---

## [Signals: Async/sync mixed receivers](https://forum.djangoproject.com/t/signals-async-sync-mixed-receivers/45187)

<div class="topic-metadata">

**Author:** [@ohaas](https://forum.djangoproject.com/u/ohaas)\
**Replies:** 2\
**Last updated:** [May 26, 2026, 7:24pm UTC](https://forum.djangoproject.com/t/signals-async-sync-mixed-receivers/45187 "2026-05-26T19:24:39Z")

</div>

Hello! I’ve been looking into getting some of my favorite packages ready for async. One caveat I encountered is how to use signals, provided a package aims for a no-downsides approach to simultaneous sync & async suppor…

---

## [AsyncTestClient](https://forum.djangoproject.com/t/asynctestclient/43841)

<div class="topic-metadata">

**Author:** [@evilmonkey19](https://forum.djangoproject.com/u/evilmonkey19)\
**Replies:** 14\
**Last updated:** [March 20, 2026, 3:51pm UTC](https://forum.djangoproject.com/t/asynctestclient/43841 "2026-03-20T15:51:10Z")

</div>

Hello everyone, I was writing the tests for a service that I’m doing and I was trying to use the async capabilities all around, even in the tests. In some blogs I’ve seen that there’s a class which I can inherit from ca…

---

## [A datapoint for asgiref performance](https://forum.djangoproject.com/t/a-datapoint-for-asgiref-performance/34633)

<div class="topic-metadata">

**Author:** [@rtpg](https://forum.djangoproject.com/u/rtpg)\
**Replies:** 6\
**Last updated:** [March 17, 2026, 11:57am UTC](https://forum.djangoproject.com/t/a-datapoint-for-asgiref-performance/34633 "2026-03-17T11:57:58Z")

</div>

I have been working on some perf issues in some code (that, granted, has many problems intrinsic to its design). I’ve found that async\_to\_sync and sync\_to\_async-wrapped calls tend to cost me 3ms-5ms per call. This is ob…

---

## [StreamingResponse driven by a TaskGroup](https://forum.djangoproject.com/t/streamingresponse-driven-by-a-taskgroup/40320)

<div class="topic-metadata">

**Author:** [@graingert](https://forum.djangoproject.com/u/graingert)\
**Replies:** 9\
**Last updated:** [January 28, 2026, 12:42pm UTC](https://forum.djangoproject.com/t/streamingresponse-driven-by-a-taskgroup/40320 "2026-01-28T12:42:42Z")

</div>

I’d like to be able to return a streaming response driven by a TaskGroup eg: async def news\_and\_weather(request: HttpRequest) -\> StreamingHttpResponse: async def gen(): async def push(ws\_url: str, tx: Memory…

---

## [How does Django handles async ORM queries?](https://forum.djangoproject.com/t/how-does-django-handles-async-orm-queries/42839)

<div class="topic-metadata">

**Author:** [@laggron42](https://forum.djangoproject.com/u/laggron42)\
**Replies:** 2\
**Last updated:** [January 16, 2026, 11:57am UTC](https://forum.djangoproject.com/t/how-does-django-handles-async-orm-queries/42839 "2026-01-16T11:57:12Z")

</div>

Hello there! I’m very new to Django’s internals, and something’s been troubling me with asynchronous support. For context, I’m using Django along a discord.py bot, meaning the context is always asynchronous, all my quer…

---

## [Django psql async - what dB backend to use?](https://forum.djangoproject.com/t/django-psql-async-what-db-backend-to-use/43598)

<div class="topic-metadata">

**Author:** [@zell2002](https://forum.djangoproject.com/u/zell2002)\
**Replies:** 1\
**Last updated:** [December 3, 2025, 1:07am UTC](https://forum.djangoproject.com/t/django-psql-async-what-db-backend-to-use/43598 "2025-12-03T01:07:35Z")

</div>

Not sure if correct place to post, and this will be an incredible dumb question, but.. how do I know if my async ORM funcs are actually running in async? Do I need a specific dB backend engine? Can I log a specific pro…

---

## [Difference in REMOTE\_USER source between sync and async code (Django 5.2)](https://forum.djangoproject.com/t/difference-in-remote-user-source-between-sync-and-async-code-django-5-2/42216)

<div class="topic-metadata">

**Author:** [@whyscream](https://forum.djangoproject.com/u/whyscream)\
**Replies:** 3\
**Last updated:** [August 5, 2025, 4:40am UTC](https://forum.djangoproject.com/t/difference-in-remote-user-source-between-sync-and-async-code-django-5-2/42216 "2025-08-05T04:40:51Z")

</div>

Hi, I’m running into an issue where my django app is using Windows NTLM authentication and receiving the REMOTE\_USER variable from IIS. In Django 5.2, async code for the RemoteUserBackend and RemoteUserMiddleware have b…

---

## [What is the advantage of async views? Why is adrf mentioned in Existing Third Party Packages?](https://forum.djangoproject.com/t/what-is-the-advantage-of-async-views-why-is-adrf-mentioned-in-existing-third-party-packages/41596)

<div class="topic-metadata">

**Author:** [@SimonVitt](https://forum.djangoproject.com/u/SimonVitt)\
**Replies:** 4\
**Last updated:** [June 27, 2025, 7:59pm UTC](https://forum.djangoproject.com/t/what-is-the-advantage-of-async-views-why-is-adrf-mentioned-in-existing-third-party-packages/41596 "2025-06-27T19:59:45Z")

</div>

Hello everyone, we recently migrated from WSGI to ASGI, and things have gone quite smoothly. I also started implementing AsyncAPIViews (via ADRF) in places where we call external APIs. The idea being that using aiohttp …

---

## [DEP 0009: Async-capable Django (Discussion about connection for #35629)](https://forum.djangoproject.com/t/dep-0009-async-capable-django-discussion-about-connection-for-35629/40824)

<div class="topic-metadata">

**Author:** [@Arfey](https://forum.djangoproject.com/u/Arfey)\
**Replies:** 5\
**Last updated:** [June 18, 2025, 10:54pm UTC](https://forum.djangoproject.com/t/dep-0009-async-capable-django-discussion-about-connection-for-35629/40824 "2025-06-18T22:54:52Z")

</div>

DEP 0009: Async-capable Django (Discussion about async connection for #35629) sources: original mr - Fixed #35629 -- Added support for async database connections and cursors. by fcurella · Pull Request #18408 · django…

---

## [Huge performance difference when using ASGI and WSGI](https://forum.djangoproject.com/t/huge-performance-difference-when-using-asgi-and-wsgi/30344)

<div class="topic-metadata">

**Author:** [@AdamYogan](https://forum.djangoproject.com/u/AdamYogan)\
**Replies:** 9\
**Last updated:** [June 5, 2025, 8:33pm UTC](https://forum.djangoproject.com/t/huge-performance-difference-when-using-asgi-and-wsgi/30344 "2025-06-05T20:33:19Z")

</div>

I have been testing my backend based on Django and Django Rest Framework. I wanted to check what is the minimal possible response time for my REST services. I was doing testing with ASGI and WSGI configuration. Differenc…

---

## [possible clean-up problem with \`sync\_to\_async\`](https://forum.djangoproject.com/t/possible-clean-up-problem-with-sync-to-async/41017)

<div class="topic-metadata">

**Author:** [@amirreza8002](https://forum.djangoproject.com/u/amirreza8002)\
**Replies:** 3\
**Last updated:** [May 21, 2025, 6:39pm UTC](https://forum.djangoproject.com/t/possible-clean-up-problem-with-sync-to-async/41017 "2025-05-21T18:39:59Z")

</div>

hi so i was looking at the test case for signals and saw that there are no tests for the async asend method so i made a copy of django/tests/dispatch/tests.py at main · django/django · GitHub this test which looks like…

---

## [Is DEP009 ("async-capable Django") still relevant?](https://forum.djangoproject.com/t/is-dep009-async-capable-django-still-relevant/30132)

<div class="topic-metadata">

**Author:** [@bigfootjon](https://forum.djangoproject.com/u/bigfootjon)\
**Replies:** 44\
**Last updated:** [May 8, 2025, 4:21pm UTC](https://forum.djangoproject.com/t/is-dep009-async-capable-django-still-relevant/30132 "2025-05-08T16:21:13Z")

</div>

Should DEP009 still be persued? On another thread, @carltongibson and I have been discussing what would be good areas for further investment in async Django and we realized this topic might deserve a broader discussion. …

---

## [Is It Necessary to Test Race Conditions for Redis Connection Pool?](https://forum.djangoproject.com/t/is-it-necessary-to-test-race-conditions-for-redis-connection-pool/39928)

<div class="topic-metadata">

**Author:** [@HappyDingning](https://forum.djangoproject.com/u/HappyDingning)\
**Replies:** 1\
**Last updated:** [March 27, 2025, 6:21am UTC](https://forum.djangoproject.com/t/is-it-necessary-to-test-race-conditions-for-redis-connection-pool/39928 "2025-03-27T06:21:51Z")

</div>

Hello Django Community, I apologize if I’ve posted this in the wrong section. I couldn’t find a dedicated discussion area for Redis or cache-related bugs. This topic is about Ticket #35651 and this PR. I’m working on …

---

## [Adding async to Django testing](https://forum.djangoproject.com/t/adding-async-to-django-testing/343)

<div class="topic-metadata">

**Author:** [@griff\_rees](https://forum.djangoproject.com/u/griff_rees)\
**Replies:** 7\
**Last updated:** [November 17, 2019, 6:40pm UTC](https://forum.djangoproject.com/t/adding-async-to-django-testing/343 "2019-11-17T18:40:59Z")

</div>

Hi all, NB: It’s worth prefacing this with acknowledging I’ve never used async before and apologies for any silly mistakes below… I’ve been working on adding a an async option to django’s test suite to: Better test a…

---

## [An asgiref async\_to\_sync microbenchmark](https://forum.djangoproject.com/t/an-asgiref-async-to-sync-microbenchmark/38600)

<div class="topic-metadata">

**Author:** [@rtpg](https://forum.djangoproject.com/u/rtpg)\
**Replies:** 0\
**Last updated:** [February 6, 2025, 11:22am UTC](https://forum.djangoproject.com/t/an-asgiref-async-to-sync-microbenchmark/38600 "2025-02-06T11:22:18Z")

</div>

So I previously posted about sync\_to\_async performance, roughly. As part of exploring alternatives to my “unasyncifying codegen” DEP I realized I had made a very massive category error: I had somehow decided that async\_…

---

## [async support in django shell](https://forum.djangoproject.com/t/async-support-in-django-shell/37430)

<div class="topic-metadata">

**Author:** [@amirreza8002](https://forum.djangoproject.com/u/amirreza8002)\
**Replies:** 7\
**Last updated:** [January 7, 2025, 12:58pm UTC](https://forum.djangoproject.com/t/async-support-in-django-shell/37430 "2025-01-07T12:58:04Z")

</div>

hi as you know python interactive shell can be called as python -m asyncio which alows awaiting in the shell but django doesn’t seems to support that, which makes testing async stuff hard is there any plans to add thi…

---

## [DEP0009/ORM implementation plan](https://forum.djangoproject.com/t/dep0009-orm-implementation-plan/33194)

<div class="topic-metadata">

**Author:** [@fcurella](https://forum.djangoproject.com/u/fcurella)\
**Replies:** 14\
**Last updated:** [December 5, 2024, 6:42am UTC](https://forum.djangoproject.com/t/dep0009-orm-implementation-plan/33194 "2024-12-05T06:42:40Z")

</div>

I’ve took a first pass at adding async-native support to the ORM. No surprises, it’s going to be a big change in terms of code review, so I think we should break it into smaller phases. Ideally each of them would be a P…

---

## [Proposals For Forwards/Backwards Compatibility With Async Model Methods](https://forum.djangoproject.com/t/proposals-for-forwards-backwards-compatibility-with-async-model-methods/36191)

<div class="topic-metadata">

**Author:** [@rtpg](https://forum.djangoproject.com/u/rtpg)\
**Replies:** 1\
**Last updated:** [November 7, 2024, 1:12am UTC](https://forum.djangoproject.com/t/proposals-for-forwards-backwards-compatibility-with-async-model-methods/36191 "2024-11-07T01:12:55Z")

</div>

This is part of me trying to generate consensus on “completing” DEP 0009. See also this DEP proposal for implementation questions. The following is about how to handle backwards compatibility for users when changing ou…

---

## [Using asgiref 3.8.1 and django 4.2.16 result deadlock](https://forum.djangoproject.com/t/using-asgiref-3-8-1-and-django-4-2-16-result-deadlock/35699)

<div class="topic-metadata">

**Author:** [@luxiaoyong](https://forum.djangoproject.com/u/luxiaoyong)\
**Replies:** 12\
**Last updated:** [October 24, 2024, 6:27am UTC](https://forum.djangoproject.com/t/using-asgiref-3-8-1-and-django-4-2-16-result-deadlock/35699 "2024-10-24T06:27:06Z")

</div>

Background: Upgraded Django from 3.2.22 to 4.2.16, and asgiref from 3.5.2 to 3.8.1. Phenomenon: The execution method of the interfaces has changed from serial to parallel. When a certain interface times out (nginx is…

---

## [Asyncifying django.contrib.auth? (and signals, and maybe sessions)](https://forum.djangoproject.com/t/asyncifying-django-contrib-auth-and-signals-and-maybe-sessions/18770)

<div class="topic-metadata">

**Author:** [@bigfootjon](https://forum.djangoproject.com/u/bigfootjon)\
**Replies:** 35\
**Last updated:** [October 8, 2024, 5:27am UTC](https://forum.djangoproject.com/t/asyncifying-django-contrib-auth-and-signals-and-maybe-sessions/18770 "2024-10-08T05:27:44Z")

</div>

Hey everyone, I’m working on a plan to try and asyncify django.contrib.auth. I’ve chatted about this on the django-developers mailing list (https://groups.google.com/g/django-developers/c/T8zBnYO78YQ) and it’s starting t…

---

## [\_AssertNumQueriesContext not async compatible](https://forum.djangoproject.com/t/assertnumqueriescontext-not-async-compatible/35360)

<div class="topic-metadata">

**Author:** [@AMontagu](https://forum.djangoproject.com/u/AMontagu)\
**Replies:** 2\
**Last updated:** [October 7, 2024, 3:23pm UTC](https://forum.djangoproject.com/t/assertnumqueriescontext-not-async-compatible/35360 "2024-10-07T15:23:59Z")

</div>

Hello I just tryed to use self.assertNumQueries in full async test. Code ref: django/django/test/testcases.py at 1feedc8ef8a34484cb5afe33f5c45b543b860210 · django/django · GitHub I also tryed to hack the issue like: a…

---

## [Parallelism across the same django DB connection?](https://forum.djangoproject.com/t/parallelism-across-the-same-django-db-connection/32717)

<div class="topic-metadata">

**Author:** [@rtpg](https://forum.djangoproject.com/u/rtpg)\
**Replies:** 10\
**Last updated:** [August 27, 2024, 11:57am UTC](https://forum.djangoproject.com/t/parallelism-across-the-same-django-db-connection/32717 "2024-08-27T11:57:18Z")

</div>

Right now my understanding is the ORM serializes async DB requests through sync\_to\_async (is this understanding correct?). My other understanding is that even if we use async-capable connection objects through psycopg3, …

---

## [Motive for synchronous connections](https://forum.djangoproject.com/t/motive-for-synchronous-connections/32745)

<div class="topic-metadata">

**Author:** [@bmos](https://forum.djangoproject.com/u/bmos)\
**Replies:** 4\
**Last updated:** [July 11, 2024, 2:48am UTC](https://forum.djangoproject.com/t/motive-for-synchronous-connections/32745 "2024-07-11T02:48:59Z")

</div>

Are there good reasons for Django using synchronous connection and cursors as opposed to async ones? We are thinking of extending Django with support for async connections and are wondering if sync-only is a design decis…

---

## [DEP0009/ORM and backward-compatibility](https://forum.djangoproject.com/t/dep0009-orm-and-backward-compatibility/32175)

<div class="topic-metadata">

**Author:** [@fcurella](https://forum.djangoproject.com/u/fcurella)\
**Replies:** 7\
**Last updated:** [July 6, 2024, 5:21pm UTC](https://forum.djangoproject.com/t/dep0009-orm-and-backward-compatibility/32175 "2024-07-06T17:21:19Z")

</div>

I’m working on a PoC for DEP0009, and I a little unclear on the backward-compatibility approach. Currently, it is possible to await an async method (eg .aget()) with a sync-only DatabaseWrapper, and it will call the cor…

---

## [Maybe it's just a blind spot, when it comes to async django](https://forum.djangoproject.com/t/maybe-its-just-a-blind-spot-when-it-comes-to-async-django/20226)

<div class="topic-metadata">

**Author:** [@pwtail](https://forum.djangoproject.com/u/pwtail)\
**Replies:** 22\
**Last updated:** [May 5, 2024, 8:46am UTC](https://forum.djangoproject.com/t/maybe-its-just-a-blind-spot-when-it-comes-to-async-django/20226 "2024-05-05T08:46:20Z")

</div>

Hi, django fellows! @andrewgodwin says in DEP-9 that there is no easy way to make django async. I remember he was doing a talk on this and asked the audience: “Why can’t we just add async and await everywere?” The answe…

[Next page](https://forum.djangoproject.com/c/internals/async/8.md?page=1)
