josephabrahams / heroku-django-template

A Django 1.7 base template featuring all recommended best practices for deployment on Heroku and local development.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Heroku Django Starter Template

An utterly fantastic project starter template for Django 1.7.

Features

  • Production-ready configuration for Static Files, Database Settings, Gunicorn, etc.
  • Enhancements to Django's static file serving functionality via WhiteNoise
  • Enhancements to Django's database functionality via django-postgrespool and dj-database-url

How to Use

To use this project, follow these steps:

  1. Create and enter a new project directory.
  2. Create a working environment.
  3. Create your new project using this template.

Creating Your Project

$ django-admin.py startproject {{ project_name }} . --template=http://joseph.is/on-a-deadline --name=.env,Procfile,README.md

Local Development

$ createdb {{ project_name }}

$ pip install -r requirements.txt
$ foreman run python manage.py collectstatic
$ foreman run python manage.py migrate

$ foreman start
$ open http://localhost:5000

Deployment to Heroku

$ git init
$ git add -A
$ git commit -m "Initial commit"

$ heroku create foo
$ heroku config:set ALLOWED_HOSTS=foo.herokuapp.com
$ heroku config:set DEBUG=off
$ heroku config:set SECRET_KEY=bar
$ git push heroku master

$ heroku run python manage.py migrate

You can replace foo with your desired Heroku app name and bar with your production secret key.

Further Reading

About

A Django 1.7 base template featuring all recommended best practices for deployment on Heroku and local development.


Languages

Language:Python 100.0%