%global _empty_manifest_terminate_build 0 Name: python-djangopubsub Version: 0.3.5 Release: 1 Summary: Base redis pubsub django wrapper License: COPYRIGHT URL: https://gitlab.com/kas-factory/packages/django-pubsub Source0: https://mirrors.aliyun.com/pypi/web/packages/81/71/c61bf2053ead2cdf2920dab47bf078d21e625a79293b74567293b100771c/djangopubsub-0.3.5.tar.gz BuildArch: noarch %description # Django pubsub Django Pubsub wrapper. ## Installation with requirements.txt ``` djangopubsub ``` ### With PIP ```bash $ pip install djangopubsub ``` ## Add app to django settings ``` INSTALLED_APPS = ( ..., 'djangopubsub' ) ``` ## Available settings and defaults: ```python 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 ```python @on_event('EVENT_NAME') def func_to_execute(data): pass ``` ## Pubsub emit ```python from djangopubsub.djangoPubSub import DjangoPubSub DjangoPubSub().emit('EVENT_NAME', {}) ``` ## Pubsub receiver Needs redis running on port:REDIS_PORT ```commandline python manage.py runpubsubreceiver --settings=your_proyect.settings ``` %package -n python3-djangopubsub Summary: Base redis pubsub django wrapper Provides: python-djangopubsub BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-djangopubsub # Django pubsub Django Pubsub wrapper. ## Installation with requirements.txt ``` djangopubsub ``` ### With PIP ```bash $ pip install djangopubsub ``` ## Add app to django settings ``` INSTALLED_APPS = ( ..., 'djangopubsub' ) ``` ## Available settings and defaults: ```python 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 ```python @on_event('EVENT_NAME') def func_to_execute(data): pass ``` ## Pubsub emit ```python from djangopubsub.djangoPubSub import DjangoPubSub DjangoPubSub().emit('EVENT_NAME', {}) ``` ## Pubsub receiver Needs redis running on port:REDIS_PORT ```commandline python manage.py runpubsubreceiver --settings=your_proyect.settings ``` %package help Summary: Development documents and examples for djangopubsub Provides: python3-djangopubsub-doc %description help # Django pubsub Django Pubsub wrapper. ## Installation with requirements.txt ``` djangopubsub ``` ### With PIP ```bash $ pip install djangopubsub ``` ## Add app to django settings ``` INSTALLED_APPS = ( ..., 'djangopubsub' ) ``` ## Available settings and defaults: ```python 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 ```python @on_event('EVENT_NAME') def func_to_execute(data): pass ``` ## Pubsub emit ```python from djangopubsub.djangoPubSub import DjangoPubSub DjangoPubSub().emit('EVENT_NAME', {}) ``` ## Pubsub receiver Needs redis running on port:REDIS_PORT ```commandline python manage.py runpubsubreceiver --settings=your_proyect.settings ``` %prep %autosetup -n djangopubsub-0.3.5 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-djangopubsub -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Tue Jun 20 2023 Python_Bot - 0.3.5-1 - Package Spec generated