Skip to main content

Base redis pubsub django wrapper

Project description

Django pubsub

Django Pubsub wrapper.

Installation with requirements.txt

djangopubsub

With PIP

$ pip install djangopubsub

Add app to django settings

INSTALLED_APPS = (
    ...,
    'djangopubsub'
)

Available settings and defaults:

BASE_DIR = ''  # Root directory for handlers lookup
EVENT_HANDLERS_DIR_NAME = 'event_handlers'  #  Directory with handlers on every app module
HANDLER_FILES_PREFIX = 'handlers_' # handlers file prefix
REDIS_HOST = 'localhost'
REDIS_PORT = 6379 
PUB_SUB_EMIT = True  # Avoid to emit message when emit is called (for tests)

Decorator

@on_event('EVENT_NAME')
def func_to_execute(data):
    pass

Pubsub emit

from djangopubsub.djangoPubSub import DjangoPubSub
DjangoPubSub().emit('EVENT_NAME', {})

Pubsub receiver

Needs redis running on port:REDIS_PORT

python manage.py runpubsubreceiver --settings=your_proyect.settings

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

djangopubsub-0.3.5.tar.gz (3.7 kB view details)

Uploaded Source

File details

Details for the file djangopubsub-0.3.5.tar.gz.

File metadata

  • Download URL: djangopubsub-0.3.5.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.12

File hashes

Hashes for djangopubsub-0.3.5.tar.gz
Algorithm Hash digest
SHA256 bdd36251fa1d420abcf920d5ce63bed0cae3b8d29a6acf92370e1da3e004ebca
MD5 962e99d9950417db67918e594aca5188
BLAKE2b-256 8171c61bf2053ead2cdf2920dab47bf078d21e625a79293b74567293b100771c

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