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'
@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.13.tar.gz
(4.1 kB
view hashes)
Built Distribution
Close
Hashes for star_lord-0.0.13-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1270e915a4353cf501fd76fd1d8fb497a43f623d61a42e38b69c4c19306b5190 |
|
MD5 | aff22f44a9546402b57bcc8ff057fd3d |
|
BLAKE2b-256 | 19f144c303a60ad52353196cdd30679026511d525b5cbfcfcea24d6fbb8356f1 |