Skip to content

A visual indicator of what environment/system you're using in django

License

Notifications You must be signed in to change notification settings

marksweb/django-sys-indicator

Repository files navigation

django-sys-indicator

pre-commit.ci status https://img.shields.io/github/license/marksweb/django-sys-indicator https://img.shields.io/github/issues/marksweb/django-sys-indicator

A visual indicator of what environment/system you're using in django.

system indicator examples

To install:

  • Add "django_sys_indicator.apps.DjangoSysIndicatorConfig" to your INSTALLED_APPS
  • Add "django_sys_indicator.middleware.SystemIndicatorMiddleware" to your MIDDLEWARE

Configuration settings and their defaults

SYSTEM_INDICATOR_ENABLED = False
SYSTEM_INDICATOR_LABEL = "localhost"
SYSTEM_INDICATOR_COLORS = {
    # Format here is colour, border colour
    "red": ("#c50000", "#daa"),
    "blue": ("#006fc4", "#aad"),
    "green": ("#009e00", "#ada"),
    "purple": ("#800080", "#dad"),
    "orange": ("#ff7700", "#ffb57d"),
}

SYSTEM_INDICATOR_COLOR = "red"

SYSTEM_INDICATOR_EXCLUSIONS = []

To exclude paths, include regex in SYSTEM_INDICATOR_EXCLUSIONS

import re

SYSTEM_INDICATOR_EXCLUSIONS = [
    re.compile("^/[^/]+/admin/.\*$"),
]

Example of a localhost indicator in admin;

system indicator admin example

About

A visual indicator of what environment/system you're using in django

Resources

License

Stars

Watchers

Forks

Packages

No packages published