django-redis-admin


Namedjango-redis-admin JSON
Version 0.3.0 PyPI version JSON
download
home_pagehttps://github.com/WoLpH/django-redis-admin
SummaryA Django Admin interface for Redis servers with optional Redis Sentinel support
upload_time2023-08-21 01:41:26
maintainer
docs_urlNone
authorRick van Hattem (Wolph)
requires_python
licenseBSD
keywords django redis admin
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ==============================================================================
Django Redis Admin
==============================================================================

.. Travis status:
   
   .. image:: https://travis-ci.org/WoLpH/django-redis-admin.svg?branch=master
     :target: https://travis-ci.org/WoLpH/django-redis-admin

Introduction
==============================================================================

With `django-redis-admin` you can view (and in the future, edit) your Redis 
databases. It supports simple servers, master slave setups and sentinel setups.

The admin works by creating a `RedisQueryset` which fakes Django models and 
querysets so the `ModelAdmin` thinks it's using a regular database backed model.

Since Redis only supports basic types the library allows for optional `base64`
encoding/decoding and `json` encoding/decoding.

While I would not recommend using it as a regular queryset to access Redis. In
addition to querying data it does some extra queries which you usually don't
need (such as fetching idle data) and it does some automatic conversion steps.

Requirements
==============================================================================

* Python `3.6` and above
* Django (tested with 2.1, probably works with any version that supports
  Python 3)
* Python-redis (`pip install redis`)

Installation
==============================================================================

`django-redis-admin` can be installed via pip.

.. code-block:: bash

    pip install django-redis-admin

Then just add `redis_admin` to your `INSTALLED_APPS`.

Optionally, configure your servers if you have multiple and/or non-standard 
(i.e. non-localhost) redis servers.

Below are several example configurations. The default settings can always be
found in `redis_admin/settings.py`

You can run the demo project using the following commands:

.. code-block:: bash

    cd test_redis_admin
    python manage.py runserver

The default username/password is `admin`/`admin`: http://localhost:8080/admin/

Basic configuration
------------------------------------------------------------------------------

.. code-block:: python

    # https://redis-py.readthedocs.io/en/latest/index.html#redis.Redis
    REDIS_SERVERS = dict(
        localhost=dict(),
    )

Explicit configuration
------------------------------------------------------------------------------

.. code-block:: python

   # https://redis-py.readthedocs.io/en/latest/index.html#redis.Redis
   REDIS_SERVERS = dict(
       redis_server_a=dict(host='127.0.0.1', port=6379, db=0),
   )

Master slave configuration
------------------------------------------------------------------------------

.. code-block:: python

   # https://redis-py.readthedocs.io/en/latest/index.html#redis.Redis
   REDIS_SERVERS = dict(
       redis_server_a=dict(
       	 master=dict(host='master_hostname', port=6379, db=0),
       	 slave=dict(host='slave_hostname', port=6379, db=0),
      )
   )

Sentinel Configuration
------------------------------------------------------------------------------

.. code-block:: python

   # The `REDIS_SENTINELS` setting should be a list containing host/port
   # combinations. As documented here:
   # https://github.com/andymccurdy/redis-py/blob/master/README.rst#sentinel-support
   REDIS_SENTINELS = [('server_a', 26379), ('server_b', 26379)]

   # The `REDIS_SENTINEL_OPTIONS` are the extra arguments to
   # `redis.sentinel.Sentinel`:
   # https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/sentinel.py#L128-L155
   REDIS_SENTINEL_OPTIONS = dict(socket_timeout=0.1)

   # The `service_name` is used to find the server within the Sentinel
   # configuration. The dictionary key will be used as the name in the admin
   # https://redis-py.readthedocs.io/en/latest/index.html#redis.Redis
   REDIS_SERVERS = dict(
        name_in_admin=dict(service_name='name_in_sentinel'),
        other_server=dict(service_name='other_server'),
   )

Base64 and/or JSON decoding
------------------------------------------------------------------------------

As a convenient option all values can optionally be `base64` and/or `json`
encoded. To configure this a regular expression can be specified which will be
matched against the keys.

.. code-block:: python

   # For all keys
   REDIS_JSON_KEY_RE = '.*'
   REDIS_BASE64_KEY_RE = '.*'

   # Keys starting with a pattern:
   REDIS_BASE64_KEY_RE = '^some_prefix.*'

   # Keys ending with a pattern:
   REDIS_JSON_KEY_RE = '.*some_suffix$'

And if a specific `json` decoder is needed, the `json` module can be specified.
The module needs to be importable and have a `dumps` and `loads` method. By
default it simply imports the `json` module:

.. code-block:: python

   REDIS_JSON_MODULE = 'json'

Representation cropping
------------------------------------------------------------------------------

Within the Django Admin list view the values are cropped by default to prevent really long lines. This size can be adjusted through:

.. code-block:: python

   REDIS_REPR_CROP_SIZE = 150

TODO
==============================================================================

- Allow saving values
- Allow deleting values
- Support Redis Bitmaps
- Support Redis HyperLogLogs


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/WoLpH/django-redis-admin",
    "name": "django-redis-admin",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "Django Redis Admin",
    "author": "Rick van Hattem (Wolph)",
    "author_email": "wolph@wol.ph",
    "download_url": "https://files.pythonhosted.org/packages/4e/b6/f0e2b392fba662aca4d983b17f1727749a4958154e00421e006a4cf1b8a0/django-redis-admin-0.3.0.tar.gz",
    "platform": null,
    "description": "==============================================================================\nDjango Redis Admin\n==============================================================================\n\n.. Travis status:\n   \n   .. image:: https://travis-ci.org/WoLpH/django-redis-admin.svg?branch=master\n     :target: https://travis-ci.org/WoLpH/django-redis-admin\n\nIntroduction\n==============================================================================\n\nWith `django-redis-admin` you can view (and in the future, edit) your Redis \ndatabases. It supports simple servers, master slave setups and sentinel setups.\n\nThe admin works by creating a `RedisQueryset` which fakes Django models and \nquerysets so the `ModelAdmin` thinks it's using a regular database backed model.\n\nSince Redis only supports basic types the library allows for optional `base64`\nencoding/decoding and `json` encoding/decoding.\n\nWhile I would not recommend using it as a regular queryset to access Redis. In\naddition to querying data it does some extra queries which you usually don't\nneed (such as fetching idle data) and it does some automatic conversion steps.\n\nRequirements\n==============================================================================\n\n* Python `3.6` and above\n* Django (tested with 2.1, probably works with any version that supports\n  Python 3)\n* Python-redis (`pip install redis`)\n\nInstallation\n==============================================================================\n\n`django-redis-admin` can be installed via pip.\n\n.. code-block:: bash\n\n    pip install django-redis-admin\n\nThen just add `redis_admin` to your `INSTALLED_APPS`.\n\nOptionally, configure your servers if you have multiple and/or non-standard \n(i.e. non-localhost) redis servers.\n\nBelow are several example configurations. The default settings can always be\nfound in `redis_admin/settings.py`\n\nYou can run the demo project using the following commands:\n\n.. code-block:: bash\n\n    cd test_redis_admin\n    python manage.py runserver\n\nThe default username/password is `admin`/`admin`: http://localhost:8080/admin/\n\nBasic configuration\n------------------------------------------------------------------------------\n\n.. code-block:: python\n\n    # https://redis-py.readthedocs.io/en/latest/index.html#redis.Redis\n    REDIS_SERVERS = dict(\n        localhost=dict(),\n    )\n\nExplicit configuration\n------------------------------------------------------------------------------\n\n.. code-block:: python\n\n   # https://redis-py.readthedocs.io/en/latest/index.html#redis.Redis\n   REDIS_SERVERS = dict(\n       redis_server_a=dict(host='127.0.0.1', port=6379, db=0),\n   )\n\nMaster slave configuration\n------------------------------------------------------------------------------\n\n.. code-block:: python\n\n   # https://redis-py.readthedocs.io/en/latest/index.html#redis.Redis\n   REDIS_SERVERS = dict(\n       redis_server_a=dict(\n       \t master=dict(host='master_hostname', port=6379, db=0),\n       \t slave=dict(host='slave_hostname', port=6379, db=0),\n      )\n   )\n\nSentinel Configuration\n------------------------------------------------------------------------------\n\n.. code-block:: python\n\n   # The `REDIS_SENTINELS` setting should be a list containing host/port\n   # combinations. As documented here:\n   # https://github.com/andymccurdy/redis-py/blob/master/README.rst#sentinel-support\n   REDIS_SENTINELS = [('server_a', 26379), ('server_b', 26379)]\n\n   # The `REDIS_SENTINEL_OPTIONS` are the extra arguments to\n   # `redis.sentinel.Sentinel`:\n   # https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/sentinel.py#L128-L155\n   REDIS_SENTINEL_OPTIONS = dict(socket_timeout=0.1)\n\n   # The `service_name` is used to find the server within the Sentinel\n   # configuration. The dictionary key will be used as the name in the admin\n   # https://redis-py.readthedocs.io/en/latest/index.html#redis.Redis\n   REDIS_SERVERS = dict(\n        name_in_admin=dict(service_name='name_in_sentinel'),\n        other_server=dict(service_name='other_server'),\n   )\n\nBase64 and/or JSON decoding\n------------------------------------------------------------------------------\n\nAs a convenient option all values can optionally be `base64` and/or `json`\nencoded. To configure this a regular expression can be specified which will be\nmatched against the keys.\n\n.. code-block:: python\n\n   # For all keys\n   REDIS_JSON_KEY_RE = '.*'\n   REDIS_BASE64_KEY_RE = '.*'\n\n   # Keys starting with a pattern:\n   REDIS_BASE64_KEY_RE = '^some_prefix.*'\n\n   # Keys ending with a pattern:\n   REDIS_JSON_KEY_RE = '.*some_suffix$'\n\nAnd if a specific `json` decoder is needed, the `json` module can be specified.\nThe module needs to be importable and have a `dumps` and `loads` method. By\ndefault it simply imports the `json` module:\n\n.. code-block:: python\n\n   REDIS_JSON_MODULE = 'json'\n\nRepresentation cropping\n------------------------------------------------------------------------------\n\nWithin the Django Admin list view the values are cropped by default to prevent really long lines. This size can be adjusted through:\n\n.. code-block:: python\n\n   REDIS_REPR_CROP_SIZE = 150\n\nTODO\n==============================================================================\n\n- Allow saving values\n- Allow deleting values\n- Support Redis Bitmaps\n- Support Redis HyperLogLogs\n\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "A Django Admin interface for Redis servers with optional Redis Sentinel support",
    "version": "0.3.0",
    "project_urls": {
        "Homepage": "https://github.com/WoLpH/django-redis-admin"
    },
    "split_keywords": [
        "django",
        "redis",
        "admin"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "57aff41424fa4b0534184c611e304aa5ebd0c86f7f7116a48713f0626e30f350",
                "md5": "48bbffb9aa9c27cac2593acdce2103cd",
                "sha256": "d4752f9a279f1203d92355919e5276d47b11349dad54570ec88bdc4a96b28e6d"
            },
            "downloads": -1,
            "filename": "django_redis_admin-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "48bbffb9aa9c27cac2593acdce2103cd",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 12659,
            "upload_time": "2023-08-21T01:41:24",
            "upload_time_iso_8601": "2023-08-21T01:41:24.987780Z",
            "url": "https://files.pythonhosted.org/packages/57/af/f41424fa4b0534184c611e304aa5ebd0c86f7f7116a48713f0626e30f350/django_redis_admin-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4eb6f0e2b392fba662aca4d983b17f1727749a4958154e00421e006a4cf1b8a0",
                "md5": "39fa8b7abbf345b83a8ea9234d42ff1b",
                "sha256": "e49048c315ee8e054e906bd5644d30f32039b1de79f5221044e0903ab24f121f"
            },
            "downloads": -1,
            "filename": "django-redis-admin-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "39fa8b7abbf345b83a8ea9234d42ff1b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 10806,
            "upload_time": "2023-08-21T01:41:26",
            "upload_time_iso_8601": "2023-08-21T01:41:26.663122Z",
            "url": "https://files.pythonhosted.org/packages/4e/b6/f0e2b392fba662aca4d983b17f1727749a4958154e00421e006a4cf1b8a0/django-redis-admin-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-21 01:41:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "WoLpH",
    "github_project": "django-redis-admin",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "django-redis-admin"
}
        
Elapsed time: 0.10899s