What’s the easiest way to take an existing Django view and make it “real time” via long polling?
I’d advocate decoupling your long polling endpoints entirely from the rest of your web app stack. Personally I like Node.js for this, but Tornado would work just fine too (I’ve experimented successfully with Tornado long polling in the past).
I wouldn’t even bother talking to the database from the long polling code. Instead, set it up as a sort of WebHook system. Your client starts long-polling a URL on the Tornado or Node.js server (which could be running on a sub-domain of your regular site, or could just be a separate part of the URL space proxied by something like nginx). That long polling server is set up to listen for WebHook POSTs to a protected URL, which can come from a backend process, a Celery worker, a Cron job or the Django web app itself. When the POST comes in, the long poll is instantly returned.