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
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
star-lord-0.0.32.tar.gz
(5.2 kB
view hashes)
Built Distribution
Close
Hashes for star_lord-0.0.32-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6f1e7c2a6c8e4cea52216b26a9f2010246465f00f68fac42694fe939756bc1f |
|
MD5 | 1af70876085429f8b27032044c2d0aa3 |
|
BLAKE2b-256 | df3684a24a32bdfe92bf2889f9038b3aaf440d87d8d36242a4557be33c0361ab |