Monday, 4 February 2013

Django Deployment - Fabric, GUnicorn, NGInx, Supervisor - Django-fagungis

Django has become a very popular web framework and I see lots of people confused about deploying Django projects the right way using the right tools. I myself faced a lot of problems in finding the right combination of tools for successful (and hassle free) Django Deployment.

Previously, I used Apache and mod_wsgi for Django Deployment but it required a lots of tweaking and found it to be a very lengthy process. You may go through this post to read whole account on Django Deployment issues using Apache and mod_wsgi.

After several cups of coffee and reading a lots of blogs, I found some alternatives/new-ways for Django Deployment. Those new ways/tools involved Nginx, gunicorn and supervisord with their lots of configurations. Still, when I started to use them, I found them more friendly for Django Deployment. But still I had to make some project related adjustments every time I used to deploy a new production-ready version of my project. Then I found this great tool "django-fagungis" (git - bitbucket) which promises a three step hassle free Django Deployment. After configuring it once, I just have to literally type three commands and its does my Django Deployment everytime like Aladdin's genie would have done for Aladdin. From cloning my project directly from bitbucket to configuring Nginx, Gunicorn and Supervisord on my remote server, it handles it all like a charm. You can find a detailed tutorial on how to use django-fagungis on its official site.

So, after following the initial configuration instructions of django-fagungis, I now have to type just three commands from my local machine!

fab my_project test_configuration

fab my_project setup

fab my_project deploy