Django Admin Environment Notice

raw JSON →
1.0.1 verified Mon Apr 27 auth: no python

Visually distinguish environments (e.g., development, staging, production) in Django Admin with a customizable banner. Current version 1.0.1. Low release cadence.

pip install django-admin-env-notice
error ModuleNotFoundError: No module named 'admin_env_notice'
cause Did not add the app to INSTALLED_APPS.
fix
Add 'admin_env_notice' to INSTALLED_APPS in your Django settings.
error AttributeError: 'Settings' object has no attribute 'ENV_NOTICE_SETTINGS'
cause ENV_NOTICE_SETTINGS dict not defined in settings or defined incorrectly.
fix
Add ENV_NOTICE_SETTINGS = {} to your settings file.
gotcha The environment notice only appears in Django Admin, not on the frontend.
fix If you need frontend notices, consider using a different approach or custom middleware.
gotcha The 'ENVIRONMENT_NAME' and 'ENVIRONMENT_COLOR' are not set by default; you must configure them or the notice will use default values (likely gray 'Development').
fix Set these settings in your environment or in settings.py to avoid using defaults.
deprecated The setting name 'ENVIRONMENT_NAME' and 'ENVIRONMENT_COLOR' are case-sensitive. Older documentation may use 'environment_name'.
fix Use uppercase keys as shown in the quickstart.

Add 'admin_env_notice' to INSTALLED_APPS and set ENV_NOTICE_SETTINGS in settings.py.

# Install: pip install django-admin-env-notice
# settings.py
INSTALLED_APPS = [
    ...
    'admin_env_notice',
]

ENV_NOTICE_SETTINGS = {
    'ENVIRONMENT_NAME': os.environ.get('ENVIRONMENT_NAME', 'Development'),
    'ENVIRONMENT_COLOR': os.environ.get('ENVIRONMENT_COLOR', '#808080'),
}