# django-grpc
Easy way to launch gRPC server with access to Django ORM and other handy staff.
gRPC request are much faster that traditional HTTP requests because are not
passed through standard middlewares.
## Installation
```bash
pip install django-grpc
```
Update settings.py
```python
INSTALLED_APPS = [
# ...
'django_grpc',
]
GRPCSERVER = {
'servicers': ['dotted.path.to.callback'],
'interceptors': ['dotted.path.to.interceptor_class',],
'maximum_concurrent_rpcs': None,
}
```
The callback must look like following:
```python
import my_pb2
import my_pb2_grpc
def grpc_hook(server):
my_pb2_grpc.add_MYServicer_to_server(MYServicer(), server)
...
class MYServicer(my_pb2_grpc.MYServicer):
def GetPage(self, request, context):
response = my_pb2.PageResponse(title="Demo object")
return response
```
## Usage
```bash
python manage.py grpcserver
```
For developer's convenience add `--autoreload` flag during development.
## Serializers
There is an easy way to serialize django model to gRPC message using `django_grpc.serializers.serialize_model`.
## Testing
You can call methods of your servicer and decode them using `django_grpc.serializers.deserialize_message` that
will convert gRPC messages to python dictionary
History
-------
0.1.0 (2019-01-18)
++++++++++++++++++
* First release on PyPI.
Easy way to launch gRPC server with access to Django ORM and other handy staff.
gRPC request are much faster that traditional HTTP requests because are not
passed through standard middlewares.
## Installation
```bash
pip install django-grpc
```
Update settings.py
```python
INSTALLED_APPS = [
# ...
'django_grpc',
]
GRPCSERVER = {
'servicers': ['dotted.path.to.callback'],
'interceptors': ['dotted.path.to.interceptor_class',],
'maximum_concurrent_rpcs': None,
}
```
The callback must look like following:
```python
import my_pb2
import my_pb2_grpc
def grpc_hook(server):
my_pb2_grpc.add_MYServicer_to_server(MYServicer(), server)
...
class MYServicer(my_pb2_grpc.MYServicer):
def GetPage(self, request, context):
response = my_pb2.PageResponse(title="Demo object")
return response
```
## Usage
```bash
python manage.py grpcserver
```
For developer's convenience add `--autoreload` flag during development.
## Serializers
There is an easy way to serialize django model to gRPC message using `django_grpc.serializers.serialize_model`.
## Testing
You can call methods of your servicer and decode them using `django_grpc.serializers.deserialize_message` that
will convert gRPC messages to python dictionary
History
-------
0.1.0 (2019-01-18)
++++++++++++++++++
* First release on PyPI.
Metadata
Release files for django-grpc 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-grpc-0.1.8.tar.gz | 7.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_grpc-0.1.8-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 15.1 kB
Release files / django-grpc-0.1.8.tar.gz
| Download URL | django-grpc-0.1.8.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
55c3e9e39c154d87a36b1164363c2d8776e0c1ddc3f926e1142fce071b744570
|
|
BLAKE2b-256 checksum How to use checksums |
c2e644dbd457ffafe86dd121ac92943e5b32efaa6b540792ab4ead7f486326f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.7
|
Release files / django_grpc-0.1.8-py2.py3-none-any.whl
| Download URL | django_grpc-0.1.8-py2.py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
d721cd3fcf835ca85800e64677f153fc514d4e924049edc68a4aed5932a4c6df
|
|
BLAKE2b-256 checksum How to use checksums |
555598d5983407d44b01f0f451a53a03007166465bd9a5ccd95f572f4533d476
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.7
|