7.8. Views Async

7.8.1. Function Based

>>> 
... import datetime
... from django.http import HttpResponse
...
...
... async def current_datetime(request):
...     result = ...
...     return HttpResponse(result)

7.8.2. Class Based

>>> 
...    import asyncio
...    from django.http import HttpResponse
...    from django.views import View
...
...
...    class AsyncView(View):
...        async def get(self, request, *args, **kwargs):
...            result = await ...
...            return HttpResponse(result)

7.8.3. Further Reading

https://www.youtube.com/watch?v=19Uh_PA_8Rc&pp=ygUbYW5kcmV3IGdvb2R3aW4gZGphbmdvIGFzeW5j https://www.youtube.com/watch?v=-7taKQnndfo&pp=ygUbYW5kcmV3IGdvb2R3aW4gZGphbmdvIGFzeW5j https://www.youtube.com/watch?v=oMHrDy62kgE&pp=ygUbYW5kcmV3IGdvb2R3aW4gZGphbmdvIGFzeW5j https://www.youtube.com/watch?v=FhqrJ06AVPw&pp=ygUbYW5kcmV3IGdvb2R3aW4gZGphbmdvIGFzeW5j https://www.youtube.com/watch?v=t-vJkNALRjg&pp=ygUbYW5kcmV3IGdvb2R3aW4gZGphbmdvIGFzeW5j