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


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 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 hashes
Filename, size django-microframework-0.1.0.tar.gz (5.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page