Django microframework allows you for easy synchronization of database entities between multiple django instances.
Project description
django-microframework
Django microframework allows you for easy synchronization of database entities between multiple django instances.
Requirements
- Python (3.6, 3.7, 3.8)
- Django (1.11, 2.0, 2.1, 2.2)
Installation
pip install django-microframework
python manage.py migrate
Usage
Sender
In your models.py file:
from microframework.sender import connect_signals
connect_signals([RegularModel, JSONModel, TreeModel, ForeignKeyModel], 'example_sender')
In your settings.py:
MICROFRAMEWORK_AMQP_URI = 'pyamqp://guest:guest@172.17.0.5'
Listener
Create service.py file:
from microframework.handler import DjangoObjectHandler, NamekoHandlerMeta
from example.models import RegularModel, JSONModel, TreeModel, ForeignKeyModel
class ListenerService(DjangoObjectHandler, metaclass=NamekoHandlerMeta):
name = "listener_service"
sender_name = "example_sender"
synced_save_models = [RegularModel, JSONModel, TreeModel, ForeignKeyModel]
In your settings.py:
MICROFRAMEWORK_SERVICE_CLASS = "example.service:ListenerService"
MICROFRAMEWORK_AMQP_URI = 'pyamqp://guest:guest@172.17.0.5'
And add 'microframework'
to your INSTALLED_APPS
setting.
INSTALLED_APPS = [
...
'microframework',
]
In your manage.py - this needs to be put before anything else in your code:
import eventlet
eventlet.monkey_patch()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django-microframework-0.1.0.tar.gz
.
File metadata
- Download URL: django-microframework-0.1.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9bc757b9ddc91a0d96b0b8a63f86a7754cf77091ab5d7649c589bf0ee0fc107d |
|
MD5 | e3cf8eff628fef2a8f2fc0aeedf911ef |
|
BLAKE2b-256 | 464f84b2dee04b163ac24975ebf13f24936903d73ebcd13a281ccf3f191a32a9 |
File details
Details for the file django_microframework-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: django_microframework-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 941f064a263df3bb6e6ed191ff74e0844112a0ddafb281c1442c3bca5861996a |
|
MD5 | 83aa439315724066baad21fd33df9e14 |
|
BLAKE2b-256 | c1d354f589e30220079906d9f6339f68a9935f465e9b04c4fb2f8aff101a3125 |