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.36.tar.gz
(6.1 kB
view hashes)
Built Distribution
star_lord-0.0.36-py3-none-any.whl
(10.1 kB
view hashes)
Close
Hashes for star_lord-0.0.36-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c72ce2557d3ac8eaea222b497c58bcd6bd31b439525ba439f6c593f3ca683095 |
|
MD5 | 71e50b5e1b29d4b277c1161294b5ead2 |
|
BLAKE2b-256 | 6166a64f7d30c5e81c261ba93cee78c07a3b61210d2c68c7fb109870130b34e6 |