A cookiecutter template for creating Django projects and deploying them quickly using Ansible
Python Shell Makefile JavaScript CSS
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



Requirements Status

A cookiecutter template for Django. Based on pydanny's cookiecutter-django.



  • Only maintained 3rd party libraries are used.
  • PostgreSQL everywhere
  • Environment variables for configuration (This won't work with Apache/mod_wsgi).


Let's pretend you want to create a Django project called "redditclone". Rather than using startproject and then editing the results to include your name, email, and various configuration issues that always get forgotten until the worst possible moment, get cookiecutter to do all the work.

First, get cookiecutter. Trust me, it's awesome:

$ pip install cookiecutter

Now run it against this repo:

$ cookiecutter https://github.com/benregn/cookiecutter-django-ansible.git

You'll be prompted for some questions, answer them, then it will create a Django project for you.

Warning: After this point, change 'Tomas Thor Jonsson', 'benregn', etc to your own information.

It prompts you for questions. Answer them:

Cloning into 'cookiecutter-django'...
remote: Counting objects: 550, done.
remote: Compressing objects: 100% (310/310), done.
remote: Total 550 (delta 283), reused 479 (delta 222)
Receiving objects: 100% (550/550), 127.66 KiB | 58 KiB/s, done.
Resolving deltas: 100% (283/283), done.

project_name (default is "project_name is the title of the project.")? Reddit clone
repo_name (default is "repo_name is used for describing the directory structure.")? reddit_clone
author_name (default is "Your Name")? Tomas Thor Jonsson
email (default is "Your email")? benregn@gmail.com
description (default is "A short description of the project.")? A reddit clone.
year (default is "2014")?
domain_name (default is "example.com")?
public_ssh_key_path (default is "~/.ssh/id_rsa.pub")?
private_ssh_key_path (default is "~/.ssh/id_rsa")?
version (default is "0.1.0")?

Enter the project and take a look around:

$ cd reddit_clone/
$ ls

Create a GitHub repo and push it there:

$ git init
$ git add .
$ git commit -m "first awesome commit"
$ git remote add origin git@github.com:benregn/redditclone.git
$ git push -u origin master

Now take a look at your repo. Don't forget to carefully look at the generated README. Awesome, right?

Getting up and running

The steps below will get you up and running with a local development environment.

Install VirtualBox and Vagrant

To get a local development machine running, you'll need VirtualBox and Vagrant.

Install ansible

First step is to install ansible.

If you are on OSX you can use Homebrew:

$ brew update
$ brew install ansible

If not, ansible is available from PyPi via pip:

$ sudo pip install ansible

Other installation methods are listed in the ansible installation docs.


When you got ansible installled, you can run:

$ vagrant up

When ansible finishes provisioning the VM, you should have a dev server running at and uwsgi/nginx server at localhost:8080.

"Your Stuff"

Scattered throughout the Python and HTML of this project are places marked with "your stuff". This is where third-party libraries are to be integrated with your project.

Something you'd like to add?

I welcome pull requests, so just fork it :)