Visually distinguish environments in Django Admin
Project description
django-admin-env-notice
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"
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:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-admin-env-notice-0.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1fd9b40b6a4cd8f390005f200988efda1f93063f88dbfa5c4fc468b3c328e06 |
|
MD5 | 0a8f8d3d81ccf4dcc69782dfb6602ec6 |
|
BLAKE2b-256 | e2d88e5a8470e04f7eaa53a2d271c283ea289db558988b01357e0dedf6f29ed2 |
Hashes for django_admin_env_notice-0.4-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ba723f9df160f693105224b069e084db269d382a80a736bf7cdf928899ffc00 |
|
MD5 | 01d1afdb6796de3ab2467d9ce77c26bd |
|
BLAKE2b-256 | 7c9e339cd27c4471a4c69967f998dc09878c08c6eb035a5e8e3b9ed569de47f2 |