Ansible Script to Deploy a Django Application
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Deploy Django with Ansible

An opinionated Ansible deploy script for Ubuntu, Django, Postgres, Nginx and Gunicorn I use to deploy some of my django apps.

The configuration is a mix of solutions from different sources that work best for me.

Here are the articles I used to develop this deploy script:

Getting Started

  • Install Vagrant ( and VirtualBox (

  • Clone/download this repo

  • Install Ansible (Recommended: Via pip. To do that create a virtualev and run pip install -r requirements.txt within this repo's root dir)

  • Add an inventory file in the repo's root dir called hosts. To test with vagrant paste the following content into the file:

    [vagrant] default ansible_ssh_host= ansible_ssh_port=2222

  • Add a deploy ssh key from your repo to let the app pull your code. Add a file called deploy_key to the directory /roles/app/files/

  • tweak the /group_vars/all.yml file to comply with your app's setup

  • Acivate your virtualenv (run source venv/bin/activate)

  • From within this repo's root dir run vagrant up

Celery (optional)

I you want to use celery set install_celery: yes in group_vars/all.yml


  • Add more documentation


MIT licensed.