Skip to main content

django-admin-env-notice

Package Version Build Status Code Coverage

Visually distinguish environments in Django Admin. Based on great advice from post: 5 ways to make Django Admin safer by hakibenita.

Requirements

  • Python 2.7, 3.4+
  • Django 1.9+

Quickstart

Install django-admin-env-notice::

pip install django-admin-env-notice

Add it to your INSTALLED_APPS before django.contrib.admin:

INSTALLED_APPS = (
    ...
    'django_admin_env_notice',
    'django.contrib.admin',
    ...
)

Add context processor:

TEMPLATES = [
    {
        ...
        "OPTIONS": {
            "context_processors": [
                ...
                "django_admin_env_notice.context_processors.from_settings",
            ],
        },
    },
]

Set label and color for current environment:

ENVIRONMENT_NAME = "Production server"
ENVIRONMENT_COLOR = "#FF2222"

Override django admin selector if necessary (default: body), e.g: grappelli:

ENVIRONMENT_ADMIN_SELECTOR = "grp-header"

Optionally, set the environment banner to float over instead of being fixed to the top:

ENVIRONMENT_FLOAT = True

You can also set the text color (default: white) by setting:

ENVIRONMENT_TEXT_COLOR = "#00FF00"

You can stop showing the banner to unauthenticated users by setting (default: True):

ENVIRONMENT_SHOW_TO_UNAUTHENTICATED = False

Screenshots

Running Tests

Does the code actually work?

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox

Credits

Tools used in rendering this package:

Metadata

Release files for django-admin-env-notice 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-admin-env-notice 1.0.1
File Size Uploaded
django-admin-env-notice-1.0.1.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-admin-env-notice 1.0.1
File Interpreter ABI Platform
django_admin_env_notice-1.0.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 10.7 kB

Release files / django-admin-env-notice-1.0.1.tar.gz

Download URL django-admin-env-notice-1.0.1.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1fc8da895b034f24a0c49d8170397aa8fd00db9eed63d3856cbbc2add6ed4d58
BLAKE2b-256 checksum
How to use checksums
51d938724a1196c2e42431ff3cb6d08ff2e790ff3d236d4065ccb59df141b419
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.15

Release files / django_admin_env_notice-1.0.1-py2.py3-none-any.whl

Download URL django_admin_env_notice-1.0.1-py2.py3-none-any.whl
Size 5.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
353903ff22b6a483313b6f12fa94a77dca397861729ed1ba257e3ec0659ecb45
BLAKE2b-256 checksum
How to use checksums
9fab7cbc300a966ecd3b272448a50952340038294b938ff67a0fb3dacfecc68a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.15

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0

2 release files

0.4

2 release files

0.3.1

2 release files

0.3

2 release files

0.2

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page