Skip to main content

Microservice with django

Project description

Installing star-lord

The package can be installed using:

.. code-block:: bash

pip install star-lord

Add the following settings:

.. code-block:: python

INSTALLED_APPS += (
    'star_lord',
)

Creating models

Mark model as producer using "producer" decorator:

.. code-block:: python

from django.db import models
from star_lord import producer


@producer
class MyModel(models.Model):
    ...

    @classmethod
    def get_name(cls):
        return 'my_model'

    @property
    def serialized_data(self):
        """
        Optional method which can be overridden
        """
        pass

    @staticmethod
    def signal_post_save(*args, **kwargs):
        """
        Optional method which can be overridden
        """
        pass

Creating tasks

Create file tasks.py in your app: my_app: tasks.py

.. code-block:: python

from star_lord import model_sync, job_tasks
from .models import User, Employee

job_tasks('auth.usr.changed', model=User)(model_sync)
job_tasks('hrm.emp.changed')(Employee.sync)

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

star-lord-0.0.47.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

star_lord-0.0.47-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file star-lord-0.0.47.tar.gz.

File metadata

  • Download URL: star-lord-0.0.47.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.8

File hashes

Hashes for star-lord-0.0.47.tar.gz
Algorithm Hash digest
SHA256 ee33f3641f2fe5dfab1f96514c842fee29a705064b3bf593b65272c98b28d5e0
MD5 e7372814379c8e6bb9f1e4deadeb105a
BLAKE2b-256 57516f58a3d24b9cef5b459854fda21d00e81049bf201a8de3d1632d887dcec5

See more details on using hashes here.

File details

Details for the file star_lord-0.0.47-py3-none-any.whl.

File metadata

  • Download URL: star_lord-0.0.47-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.8

File hashes

Hashes for star_lord-0.0.47-py3-none-any.whl
Algorithm Hash digest
SHA256 f0d5c5bcad7743b626e48411a61ce7d00473d750e0b70e915ff273897246913c
MD5 4956065ad69bd9b8897314a40e2680dd
BLAKE2b-256 d454037029ae7fb6a394a6f2f29f4ddb964f38e228a41ca09b756302e94b88ab

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page