Hacker News new | ask | show | jobs
by StavrosK 2144 days ago
I'm not sure you're talking about the same thing, this is about asyncio/green threads.
1 comments

re-read the documentation but I'm not following. This example:

  async def current_datetime(request):
      now = datetime.datetime.now()
      html = '<html><body>It is now %s.</body></html>' % now
      return HttpResponse(html)

seems like an example that I was thinking of.
I don't know what you're thinking of, unfortunately, but that piece of code just returns the current date when you visit the page.
After taking a uninterrupted reading slot to understand the async views, you're right, and I had the concept understood wrong.
Yeah, I think you were thinking some sort of auto-refresh.
That was exactly what I was hoping this to be.
Perhaps django-reactor would be of interest to you? [1] It's targeting LiveView-like functionality for Django. I haven't used it (so I can't vouch for the claim).

1: https://pypi.org/project/django-reactor/