django-heroku
raw JSON → 0.3.1 verified Fri May 01 auth: no python maintenance
A Django library to configure your app for Heroku. Easily sets up database, static files, and other settings based on Heroku environment. Current version 0.3.1 (last released in 2018, maintenance mode).
pip install django-heroku Common errors
error ImportError: No module named 'django_heroku' ↓
cause Missing pip install or virtualenv not activated.
fix
Run pip install django-heroku and ensure your virtualenv is active.
error TypeError: settings() missing 1 required positional argument: 'django_settings_module' ↓
cause Calling django_heroku.settings() without passing the settings module (usually locals()).
fix
Use django_heroku.settings(locals()) instead of just django_heroku.settings().
Warnings
deprecated This library is in maintenance mode. The official approach is to use whitenoise, dj-database-url, and gunicorn manually. ↓
fix Instead of using django-heroku, manually configure using whitenoise and dj-database-url as described in Heroku's official Django guide.
gotcha django_heroku.settings(locals()) must be called AFTER all other settings. If called before, it can override your custom settings like STATICFILES_STORAGE. ↓
fix Ensure the call is the absolute last line in settings.py.
Imports
- django_heroku wrong
from django_heroku import ...correctimport django_heroku
Quickstart
import django_heroku
import django.conf.settings as settings
# At the bottom of settings.py:
django_heroku.settings(settings)