The example you presented should Just Work - that error generally only occurs if you return an un-awaited coroutine, which if you're just returning a response, should be impossible.
What version of Python and Django are you running? Andrew On Thu, Aug 12, 2021, at 11:03 AM, Steven Mapes wrote: > Does anyone have some links to good guides on getting asnyc to work with > Django? I have a use case where I really need to have a view give an async > response but I can't get even the most basic of examples working. > > I've tried the examples from https://testdriven.io/blog/django-async-views/ > with a simple view of: > > async def test_view(request): > return HttpResponse("Hello, async Django!") > > I've installed uvicorn and am running it with uvicorn > my_project.asgi:application --reload > > My sync views work as expected but the async one just returns an error of > "*The view sample.views.test_view didn't return an HttpResponse object. It > returned an unawaited coroutine instead. You may need to add an 'await' into > your view.*" > > > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/64f90a01-76fe-4e01-ab3a-a6a0910038c9n%40googlegroups.com > > <https://groups.google.com/d/msgid/django-users/64f90a01-76fe-4e01-ab3a-a6a0910038c9n%40googlegroups.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/378098bf-4754-4d4e-afc0-82eb04873438%40www.fastmail.com.