Skip to main content

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


Download files

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

Files for django-microframework, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size django_microframework-0.1.0-py3-none-any.whl (8.1 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size django-microframework-0.1.0.tar.gz (5.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page