Hello everyone,
I've been formulating a plan to decouple Django from the request-response cycle for a couple of years now and after discussing it with some people at DjangoCon Europe I thought it was high time that I actually wrote it up, wrote some code, and solicited feedback.
So here it is. The proposal is very long, and is in a Gist here: https://gist.github.com/andrewgodwin/b3f826a879eb84a70625
As a top-level summary:
- Fully backwards-compatible
- No actual "in-process" async like asyncio/greenlets (apart from a couple of optional "interface server" modules where you can pick your async implementation)
- New base unit of Django work is no longer the view, it is the channel consumer
- Supports WebSockets, long-polling, offsetting complex tasks outside views and more
- Code looks and works the same - since it'll be a worker model, there's no need to retrofit any core Django APIs for async stuff.
To help write the proposal and also to help you understand it, I've semi-implemented the proposal over here as a third-party app: https://github.com/andrewgodwin/django-channels
While the goal is to merge this into Django proper, prototyping and iterating outside is much faster and more accessible for everyone involved, and the goal is to get it working on 1.7 and 1.8 (currently only 1.8).
The basic chat example in the README of that project is up and running on this code (and the Redis channel backend) here: http://www.aeracode.org/chat/
Any and all feedback is welcomed, in this thread is probably best. This is by no means a final plan, but I hope it will lead us towards something that will make Django much more suitable for a modern Web.
(I'm about to get on a long flight to Tokyo, so I may not be immediately responsive! And my example might crash, it's only running the websocket server in screen!)
Andrew
Andrew
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAFwN1upKYO7MxyuRigYphJfCqqj%2BKPp_uhBgymEK2oMtP%2BJMPA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAB%2B2MZygJ10J8_bPFkE8AR%3D1mQ%3D0KKWWvXvoHhnmKaVJzZFBGQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAFwN1urENRO2bFVVncpbF_Dymv0Z1PAVUJxHW7kOScubCg4sJg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAB%2B2MZy5je0f9-UpgaRduC0_hYHrW5w3egGMTbCBF9RUzT%2BVgA%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/ebff02a5-4890-4931-a28f-8e54820f140d%40googlegroups.com.