• Stars
    star
    308
  • Rank 134,929 (Top 3 %)
  • Language
    Python
  • License
    MIT License
  • Created over 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Visually distinguish environments in Django Admin

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:

More Repositories

1

m00dbot

Telegram bot for self-testing of anxiety and depression
Python
225
star
2

django-eraserhead

πŸ’‚πŸ» Django package that provides hints to optimize database usage by deferring unused fields (and more)
Python
196
star
3

do-latency

🐳 Digital Ocean regions latency checker
Python
112
star
4

hashtable

Async hash table server in C
C
75
star
5

gray

Less uncompromising Python code formatter
Python
74
star
6

django-migrations-graph

Django-admin command to display migrations with dependencies.
Python
48
star
7

ngx_http_avatars_gen_module

πŸ–Ό Generating avatars on-the-fly with Nginx
C
33
star
8

django-compressor-autoprefixer

Django Compressor CSS filter for autoprefixer
Python
23
star
9

debugmail

SMTP testing server
JavaScript
11
star
10

nginx-lua-contact

Nginx + Lua contact form handler
Lua
10
star
11

planner

Python package for drawing 2d plans of a buildings.
Python
9
star
12

mailsender

Python cli-tool for sending emails through specified SMTP server.
Python
9
star
13

chat-app

Chat application for Ukrainian Web Challenge. Developed on php (yii), node.js (socket.io), redis etc
PHP
6
star
14

express-socketio-session-example

Example of using express session in socket.io
JavaScript
3
star
15

blazing-fast-django-tests-example

Example for "Blazing fast Django tests" blog post
Python
3
star
16

django-optimization-guide-2-sample

Python
2
star
17

dizballanze.github.io

my tech blog
CSS
2
star
18

packer-virtualbox-vagrant-debian

Minimal config of packer to build vagrant box for virtualbox with Debian 8
Shell
1
star
19

Encryption

Simple crypt algorithms on PHP
PHP
1
star
20

breaking-point

breaking-point.py helps to find a size of input data where one function starts outperform another function
Python
1
star
21

domainfilter

Domain filtration cli-tool.
CoffeeScript
1
star