Skip to main content


Project description


Casbin role watcher to be used for monitoring updates to casbin policies


pip install flask-casbin-redis-watcher

Basic Usage

from flask_casbin import CasbinEnforcer
from flask_casbin_redis_watcher import RedisWatcher
casbin_enforcer = CasbinEnforcer(app, adapter)
watcher=RedisWatcher(redis_hostname, redis_port)

Using alongside UWSGI

This redis-watcher module starts separate processes which subscribe to a redis channel, and listens for updates to the casbin policy on that channel. When running within WSGI contexts (like uwsgi) you may want to start these processes as a postfork action. As is depicted below:

    from uwsgidecorators import postfork
    print("Running in uwsgi context")
except ModuleNotFoundError:
    print("Not running in uwsgi context")
    postfork = None

if postfork:
    def load_watcher():
        global casbin_enforcer
        watcher = RedisWatcher(redis_info.hostname, redis_info.port)

Project details

Release history Release notifications

Download files

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

Files for flask-casbin-redis-watcher, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size flask_casbin_redis_watcher-0.1.0-py3-none-any.whl (3.9 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page