Django for microservice
settings.py
INSTALL_APP = [
...,
'msvc_framework',
]
MSVC_FRAMEWORK = {
'ENGINE': 'msvc_framework.broker.kafka.KafkaBroker',
'HOST': 'localhost',
'TOPIC': 'topic'
}
Service 1
register tasks in apps/{appname}/tasks.py
from msvc_framework import tasks
from msvc_framework import SUCCESS
@tasks('user.user.get')
def get_users(data):
print(data)
return {
'status': SUCCESS,
'data': [....]
}
run command
python manange.py subscribe
Service 2
sync call tasks
from msvc_framework import call
call('user.user.get', {'ids': [1]})
use in model
from msvc_framework import call
class Profile(models.Model):
user = RemoteRelatedField('user.user.get')
def __str__(self):
return self.name
profile = Profile.objects.get(user=1)
print(profile.user.get())
print(profile.user.value)
use in Serializer
from msvc_framework import ModelSerializer
class ProfileSerializer(ModelSerializer):
class Meta:
model = Merchant
fields = ('id', 'user', )
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
How to deploy
Create config file in home directory ~/.pypirc
[distutils]
index-servers=pypi
[pypi]
repository = https://upload.pypi.org/legacy/
username = myrubapa
After run command for build and deploy
python3 setup.py sdist bdist_wheel
python3 -m twine upload dist/*
for more detail read packaging-projects
License
Metadata
Release files for msvc-framework 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| msvc_framework-0.0.1.tar.gz | 4.7 kB | Without provenance | Details for msvc_framework-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| msvc_framework-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for msvc_framework-0.0.1-py3-none-any.whl |
Total release size: 13.0 kB
Release files / msvc_framework-0.0.1.tar.gz
| Download URL | msvc_framework-0.0.1.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cd2300d30a446b6ecaecd9ce81873a459c102114a34c9cc1653acf4af863e48a
|
|
BLAKE2b-256 checksum How to use checksums |
b25951de8dd8754610590a4b370dc03d0feb644f21bd707866664875790a9d0b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
|
Release files / msvc_framework-0.0.1-py3-none-any.whl
| Download URL | msvc_framework-0.0.1-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
817d71e006bc7899db9962a8cdda868ea89e0ab06f68abce20160b0467d4ebe3
|
|
BLAKE2b-256 checksum How to use checksums |
ac69428c72b98d5636a3865277e577522ff8b18b525b440cf06d367af472d7af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
|
Security for msvc-framework 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.