skip to navigation
skip to content

Djheroku 0.5.5

Some helper functionality for binding Heroku configuration to Django

Djheroku is a helper script that reads Heroku configuration from environment variables and injects them to Django configuration.

Autopilot for Heroku settings

This is an easier way to control what Django does. Just add a few lines to your

from djheroku import autopilot

Then you can make runtime changes to your application settings:

heroku addons:add sendgrid
heroku config:set ADDONS=sendgrid
heroku addons:add memcachier
heroku config:set ADDONS=sendgrid,memcachier

Djheroku will change the variables accordingly.

Configuration helpers


from djheroku import sendgrid

This is equivalent of typing in:

import os

if 'SENDGRID_USERNAME' in os.environ and 'SENDGRID_PASSWORD' in os.environ:
    EMAIL_HOST = ''
    EMAIL_PORT = 587
    EMAIL_USE_TLS = True

If any of the variables are not present, the configuration will be left as it is. Currently there are two helpers: sendgrid() and mailgun().


There are three middleware classes in Djheroku. They are used to redirect permanently from one URL to another.

  • NoWwwMiddleware removed www. from URLs of incoming requests. The opposite is built-in functionality of Django. Enable this Middleware and set NO_WWW = True in to activate.
  • PreferredDomainMiddleware redirects all domains directed to the application to a preferred one.
  • ForceSSLMiddleware redirects all non-SSL connections to a secure connection.

Each of these middlewares does one thing only and combined they will lead into three separate redirects or even a eternal loop if configured properly wrong.

File Type Py Version Uploaded on Size
Djheroku-0.5.5-py2-none-any.whl (md5) Python Wheel py2 2014-12-18 13KB
Djheroku-0.5.5-py3-none-any.whl (md5) Python Wheel py3 2016-02-23 13KB
Djheroku-0.5.5.tar.gz (md5) Source 2014-12-18 18KB