Change the future

Deploying Scalable Django Stacks to the Cloud with Juju

Kapil Thangavelu

Audience level:


The most difficult part of Django deployment is the supporting infrastructure. Juju simplifies deployment and scaling in the cloud by distilling this logic into reusable charms that are orchestrated by Juju. In this session, I'll show how to use Juju to set up Django stacks by deploying charms, including custom ones, and relating them together.


Deploying the code of a Django app itself can be quite easy, but it's much more difficult when considering other infrastructure service dependencies, such as the database or caching backend. This is especially true in the context of being able to scale, whether up or down. Consider for example the challenge of deploying a pool of memcached servers; or setting up pgBouncer; or using HAProxy; or backing Haystack with Solr; or running background tasks with celery. Not only do you have to provision machines with the necessary software. The real challenge is to configure these pieces so they know about each other, and at the right time, and then change this configuration over time as things scale up and down.

Juju, now part of Ubuntu Server, simplifies the deployment and scaling of services by distilling the necessary logic into reusable charms. Juju then takes care of provisioning machines, deploying software, and managing the service orchestration. This last part reduces to calling hooks in each charm as needed. Charms can then become comparatively simple, as seen at There are already over 100 such charms. And more can be readily written, since hooks can be readily written in any language. Python is a popular choice!

Although you can write your own custom charm to deploy a Django site, or fork from an existing one, there are simpler ways to do this task. The python-django charm is a good example of what we call a framework charm. Users can configure this charm to deploy their Django app, as well as add relations to other services. I plan to demonstrate how to deploy some interesting Django stacks with it.

However, the python-django charm doesn't do everything, at least not yet ;). You can further extend the behavior of the python-django charm by either forking it (and possibly getting your changes back into trunk); or by using subordinate charms that add any desired behaviors. Both are valid, depending on the task at hand. Guidance will be provided.

This poster session will also be a good opportunity to provide Q&A about Juju and to get feedback on desired functionality in Juju's support of Django and other related projects.