Skip to content
A template for jumpstarting Django projects and deploying with Dokku.
Python Shell Dockerfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Cookiecutter Django Dokku

A template for jumpstarting Django projects and deploying with Dokku.

Build Status Python 3.6 Django 1.11 MIT license

Instead of using django-admin startproject to start a new Django application from scratch, you can use this cookiecutter project to start with a Dockerized application ready for Dokku deployment. Some additional common Django features like an extended User model with Email as identification token field, setting up restframework, etc can also be initialized during the initial project set up.

Dokku is a mini-Heroku, powered by Docker. It simplifies the process of building and managing the lifestyle of applications. Once Dokku is set up in a host, you can push codes via Git, just like Heroku.

Instructions below specify how to start your project from this cookiecutter template and also a guideline on how to set up Dokku on your server.


Set Up A Project

cookiecutter gh:mashrikt/cookiecutter-django-dokku

Alt text

cd myproject
docker-compose up --build


Optional Integrations

These can be setup during the initial project integration

Email User

  • Django by default ships with username as the identification token field. (ie. login with username) Select 'y' to email _user for using email instead.


  • Select 'y' to use_celery for Celery with a Redis backend for Distributed Tasks.


  • To configure sentry you have to add the SENTRY_DSN_URL and initialize it with your own DSN URL that sentry provides for your project.
dokku config:set myproject SENTRY_DSN_URL=MYSENTRYDSNURL

Django REST framework:

  • Django REST framework is a powerful and flexible toolkit for building Web APIs. Select 'y' to use_rest_framework prompt for this library.


By selecting 'y' to "use_auth_endpoints":

Restframework Docs

  • Again, if you're using Restframework, you can plug in the Restframework Docs as well.

Setting up Dokku on a Linux Server

# install the latest stable version of dokku
sudo DOKKU_TAG=v0.12.10 bash

# Once the installation is complete, you can open a browser to setup your SSH key and virtualhost settings. 
# Open your browser and navigate to the host's IP address - or the domain you assigned to that IP previously
# Configure Dokku via the web admin.

# create the app
dokku apps:create myproject

# Set environtment variable for ALLOWED_HOSTS. 
# YOUR_HOST is the host's IP address - or the domain you assigned to that IP
dokku config:set ALLOWED_HOSTS=YOUR_HOST

# install the postgres plugin
sudo dokku plugin:install

# create a postgres service
dokku postgres:create myproject-database

# link postgres service to the app
dokku postgres:link myproject-database myproject

# if your're using Celery, you need to setup Redis
# install the redis plugin
sudo dokku plugin:install redis

# create a redis service
dokku redis:create myproject-redis

# link postgres service to the app
dokku redis:link myproject-redis myproject

Deploying the app from your local machine

# add remote dokku url 
git remote add dokku

# push your apllication 
git push dokku master



MIT License

You can’t perform that action at this time.