Automatic Django configuration and utilities for Heroku

Quickstart

Simplify Django configuration in two easy steps:

  1. Include django-herokuify and pylibmc packages in your requirements.txt file.
  2. In the Django settings.py of your Heroku project add:
import herokuify

from herokuify.common import *          # Common settings, SSL proxy header
from herokuify.aws import *             # AWS access keys
from herokuify.mail.mailgun import *    # Mailgun email add-on settings
from herokuify.mail.sendgrid import *   # ... or Sendgrid

DATABASES = herokuify.get_db_config()   # Database config
CACHES = herokuify.get_cache_config()   # Memcache config for Memcache/MemCachier

Additionally, you can also use storage backends that works nice with Amazon S3 and Django Compressor:

DEFAULT_FILE_STORAGE = "herokuify.storage.S3MediaStorage"
MEDIA_URL = "https://{0}.s3.amazonaws.com/media/".format(AWS_STORAGE_BUCKET_NAME)

STATICFILES_STORAGE = "herokuify.storage.CachedS3StaticStorage"
STATIC_URL = "https://{0}.s3.amazonaws.com/static/".format(AWS_STORAGE_BUCKET_NAME)

COMPRESS_STORAGE = "herokuify.storage.CachedS3StaticStorage"
COMPRESS_OFFLINE = True

Dependencies

django-herokuify installs the following dependencies by default:

  • Caching and cache configuration:

    pylibmc>=1.2.3
    django-pylibmc-sasl>=0.2.4
    django-heroku-memcacheify>=0.3
  • DB configuration:

    dj-database-url>=0.2.1
    django-heroku-postgresify>=0.2
  • Storage backend:

    django-storages>=1.1.5
    boto>=2.6.0

Note: It is necessary include pylibmc package entry in your project’s root requirements.txt file. The Heroku Django buildpack checks for this entry and configures the libmemcached C build dependency.

Table Of Contents

Next topic

Common settings

Python Development

Django web development for startups and businesses.

Quality Python development and scientific applications.

Quick links

Edit this document

The source code of this file is hosted on GitHub. Everyone can update and fix errors in this document with few clicks - no downloads needed.