Exploring push server options for Django. My presentation for Python User Group meetup, March 2018.
Some images borrowed from https://blog.heroku.com/in_deep_with_django_channels_the_future_of_real_time_apps_in_django.
2. – Renyi Khor
“Entrepreneur and CTO since 2012.
Djangonaut since 2009.
Progammer since 2006.
Programming since 1990s.”
3. Django
1.It’s a web framework.
2.It’s a heavy web framework (Batteries included).
3.It’s Secure - See No. 2.
4.It’s Python.
5.Large community.
6.It’s really good for prototyping and R&D.
4. Popular Django sites
• Disqus
• Bitbucket
• Instagram
• Pinterest
• Mozilla
• Nasa
• sentry.io, etc…
8. Django Channels
• ASGI - Asynchronous Server Gateway Interface
• Consumer-Producer Pattern
• Channels
• Worker and Background Tasks
9. Pros
• Easy to integrate with Django
• Django-ish routing
• Django ORM
• Customizable channel layers
• Make Django async
10. Cons
• Probably only heavy tested with Python and Django
users
• ASGI is quite new
• Too much work just to get websocket working
• Channels looks powerful, but complicated
11. Renyi’s Take
• Too complicated for prototyping
• May be good for R&D
• Yes or No ?
13. Tornado
• Tornado is a Python web framework and asynchronous
networking library, originally developed at FriendFeed.
14. Pros
• Built with non-blocking IO in mind.
• Many async options, long polling, websockets,
coroutines, queues, multi-process, etc.
• Lots of batteries, non-blocking HTTP server, async http
client, ioloops, iostreams, net utilities, etc.
• Play well with others, wsgi (django), twisted, asyncio
(python3.5+).
• Facebook is among the core developers.
15. Cons
• It’s more complicated to setup
• It’s harder to design applications around it
• Batteries are pretty low level (could be a PRO)
• Almost nothing is out-of-the-box (may not be a bad
thing)
16. Renyi’s Take
• Easy integration with Django (FallbackHandler)
• Makes Django async (make it green)
• Easy Django + websocket (IOLoop)
• A good scalling option for Django projects
• Yes or No ?
20. Cons
• You really shouldn’t be bothered with this.
• If you do, it’s most likely out of the scope of this
talk, :p
21. Renyi’s Take
What you need to know
• Yes. If you have a choice, choose asyncio.
• It works well with most web/networking framework.
• If not, most popular python frameworks are going to
implement it soon.
• So, choose a good web framework that uses asyncio.
• If you are working on IO stuffs, yes asyncio is really good for
your sanity.
• Yes or No ?