Skip to content
Switch branches/tags
Go to file
Cannot retrieve contributors at this time

Django Heroku Skeleton


A Django skeleton for Django 1.10.3. Build for work with Heroku. In just 15 minutes you get a running Django instance on Heroku.

0. Pre


In this readme replace:

  • myproject with your project name
  • myapp with your app name
  • yoursecretkey with your secret key
  • myapplink with your Heroku link
  • herokuappname with the name from your Heroku instance
  • githubname with your GitHub username
  • githubrepo with the name from your (new) repo
  • privatesentrydsn with your private Sentry dsn from
  • publicsentrydsn with your public Sentry dsn from

For Linux:

  • TBD

For Windows:

  • Install Windows PowerShell Link
  • Install Python 3 Link
  • Install pylauncher Link
  • Install Heroku Toolbelt Link
  • Install and configure git Link

Open PowerShell as Administrator and execute Set-ExecutionPolicy Unrestricted answer with yes. Close Powershell. (Necessary for virtualenv)

Open PowerShell with normal limited rights.

Login into Heroku


Install virtualenv

pip install virtualenv

Install actual Django version

pip install django

1. Let's start

Navigate in the console to the folder where you want to have your Django project. Then create your project and your app.

django-admin startproject --template=  --name Procfile,requirements.txt myproject
cd myproject
python startapp myapp
  • Open myproject\settings\ in your editor and add 'myapp.apps.MyappConfig', in the first line from INSTALLED_APPS. Note: You have to replace myapp 2x times.
  • Open myproject\settings\ in your editor and replace myapp in LOGGING
  • Open myproject\settings\ in your editor and replace myapp in LOGGING

Remove unnecessary stuff


Create folder for static assets and templates

mkdir myapp\templates
mkdir myapp\static

Create a virtualenv called "venv"

virtualenv venv

Activate virtualenv

For Windows


For Linux

source venv/bin/activate

To deactivate it later just type:


Install required stuff

pip install -r myproject/reqs/dev.txt

2. Run your site

Migrate database

python migrate

Spin up the development server

python runserver

Open it in your web browser and enjoy it :)

3. Deploy to Heroku

Create empty git repo

git init

Create Heroku app

heroku create myproject --region eu

Create new GitHub repo at Then connect it with your new local git repo.

git remote add github

Open with git config -e the configuration file from your local git repo and add at the end the following:

[remote "origin"]
	pushurl =
	pushurl =

You are now able to push with just one command your stuff to GitHub and Heroku.

Open myproject\settings\ and copy your Heroku-app link in ALLOWED_HOSTS = ['.myapplink']. The leading dot is important! (Without https://)

Set environment variables in Heroku

heroku config:add SECRET_KEY=yoursecretkey
heroku config:add

Create an account at Create an organisation and project. Then add your Sentry DNS code as an environment variable.

heroku config:add SENTRY_DSN=privatesentrydsn

Open temlates/500.html and replace publicsentrydsn with your public DSN from Sentry.

Note: Sentry is also available as a Heroku Addon, but unfortunately no longer as a free version.

Add Heroku modules. I choose for every module the free plan, but this can change from time to time. Please check it twice at Heroku.

Deploy Postgres. An amazing database. For more info see Postgres

heroku addons:create heroku-postgresql:hobby-dev

Deploy Papertrail. Allows you to view the logs from your app/Heroku. For more info see Papertrail

heroku addons:create papertrail:choklad	

Deploy Sendgrid. It allows you to send emails. For more info see Sendgrid

heroku addons:create sendgrid:starter

Deploy Librato. It monitors everything on Heroku for you. For more info see Librato

heroku addons:create librato:development

Add anything to git, commit and push it.

git add -A
git commit -m "Initial commit"
git push origin master

Now go to and connect your GitHub repo with Heroku.

Migrate database

heroku run python migrate

Create a superuser for your project

heroku run python createsuperuser

Finished! Enjoy your new Heroku site. If you have any remarks, improvements or anything else, I'm happy about every pull request/opened issue!

heroku open

What else?

Now you have a running Django instance on Heroku. That means you can start developing your project. If you are satisfied with django-heroku-template, you can now stop configuring and start coding. If not, here a few ideas, who are maybe helpful for you:


I borrowed a few ideas from guys who are a way more familiar with Python and Django than I am. Thanks to: