Djangocon: Django’s role in the polyglot web - David Gouldin

Tags: django, djangocon

(One of the summaries of a talk at the 2015 Djangocon EU conference).

(You can also see this presentation by David Gouldin on https://django-polyglot.herokuapp.com/ )

Django is 10 years old now. It is not a cms, but it was originally build for one.

10 years? The web in 2005 was much different from the web we know now. If you were a developer in 2005, you’d have a relational database and some php and an apache in front. Now there are many more parts. And on the server side often there are various parts that need to be connected. And... are you building a website or isn’t it more like a real-time webapp?

Ok, where does this all leave django? Django is well-placed!

  • Django is build in python. Don’t underestimate that advantage! It gives us a huge advantage over frameworks that use less mature n
  • Django is build for “perfectionists with deadlines”. One of the places where this shows up is the ORM. You can say about it what you want, but it works well and it enables the django admin, which can be a great timesaver.
  • Django rest framework. Very easy to make good APIs.
  • Celery. Easy to use. Big advantage that django+python can use this out-of-the-box.

There are some problems.

  • c10k. Sites with 10000 connections at the same time to one server. Python 2 just wasn’t really build for that and django was originally build for python 2. There are ways to work around it, but they always feel a bit hacky.
  • JS client integration.
  • Long-running connections.

You can mix-and-match to work around those problems. A “polyglot” solution. For example to get a good asynchronous solution working with a django website. Django + socket.io with redis and celery. A request comes in to django, which placed a job in the celery queue and data in redis. Once the job is done, socket.io pushes is to the client.

A common problem is shared authentication. With session cookies, you can ask django to authenticate your requests from within other programs. You could also use an access token solution. You could also let everything talk to a central authentication server.

Some closing comments:

  • We should say no to full stack python. Don’t try to do everything in python. Use the right tool for the right job.
  • http is your friend. And when it is not, pubsub is.
  • And start treating web browsers as service consumers instead of as dumb terminals.
Photo from our 2014 cycling holiday
blog comments powered by Disqus
 
vanrees.org logo

About me

My name is Reinout van Rees and I work a lot with Python (programming language) and Django (website framework). I live in The Netherlands and I'm happily married to Annie van Rees-Kooiman.

Weblog feeds

Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):