Skip to main content

Visually distinguish environments in Django Admin

Project description

=============================
django-admin-env-notice
=============================

.. image:: https://badge.fury.io/py/django-admin-env-notice.svg
:target: https://badge.fury.io/py/django-admin-env-notice

.. image:: https://travis-ci.org/dizballanze/django-admin-env-notice.svg?branch=master
:target: https://travis-ci.org/dizballanze/django-admin-env-notice

.. image:: https://codecov.io/gh/dizballanze/django-admin-env-notice/branch/master/graph/badge.svg
:target: https://codecov.io/gh/dizballanze/django-admin-env-notice

Visually distinguish environments in Django Admin. Based on great advice from post: `5 ways to make Django Admin safer <https://hackernoon.com/5-ways-to-make-django-admin-safer-eb7753698ac8>`_ by `hakibenita <https://hackernoon.com/@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`:

.. code-block:: python

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

Add context processor:

.. code-block:: python

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

Set label and color for current environment:

.. code-block:: python

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

Screenshots
-----------

.. image:: ./screenshots/prod.png
.. image:: ./screenshots/dev.png
.. image:: ./screenshots/testing.png

Running Tests
-------------

Does the code actually work?

::

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

Credits
-------

Tools used in rendering this package:

* Cookiecutter_
* `cookiecutter-djangopackage`_

.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-admin-env-notice-0.1.1.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

django_admin_env_notice-0.1.1-py2.py3-none-any.whl (5.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-admin-env-notice-0.1.1.tar.gz.

File metadata

File hashes

Hashes for django-admin-env-notice-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0150f64a7d4fef03eba699a5876b8fbd7025898c824739fe7f182d06e43dcd52
MD5 ab672d303ba30fca59ff8fb3b91eec35
BLAKE2b-256 cac07fec82d4fc973692ea3157578ebad2193f339a26b1df5f2d0439cfb73337

See more details on using hashes here.

File details

Details for the file django_admin_env_notice-0.1.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_admin_env_notice-0.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 dd984d3e714b17eddc95e9cb857cd3ed8f3eae4668cfb222094360f6c801484a
MD5 fd60be59ab87004a766d2a127a475ea9
BLAKE2b-256 d1fe47a1ea0fcbc780a76893b57b747fdaad3cd37b7e1f8388caa8e9ddedae90

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page