All Projects → fengsp → Django Grpc Framework

fengsp / Django Grpc Framework

Licence: apache-2.0
gRPC for Django.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Django Grpc Framework

Crudl Example Django
CRUDL with Django, DRF/Graphene and SQLite
Stars: ✭ 113 (-30.25%)
Mutual labels:  django, django-rest-framework
Django Vue Admin
基于RBAC模型权限控制的中小型应用的基础开发平台,前后端分离,后端采用django+django-rest-framework,前端采用vue+ElementUI,移动端采用uniapp+uView(可发布h5和小程序).
Stars: ✭ 157 (-3.09%)
Mutual labels:  django, django-rest-framework
Everbug
Django debug tool for browser
Stars: ✭ 114 (-29.63%)
Mutual labels:  django, django-rest-framework
Awx
AWX Project
Stars: ✭ 10,469 (+6362.35%)
Mutual labels:  django, django-rest-framework
Lpoj
An open source online judge system base on Django REST framework and Vue.js !
Stars: ✭ 122 (-24.69%)
Mutual labels:  django, django-rest-framework
Wq.db
☁🌐 wq's db library, extending Django REST framework to support apps for geospatial field data collection, citizen science, and crowdsourcing.
Stars: ✭ 101 (-37.65%)
Mutual labels:  django, django-rest-framework
Maria Quiteria
Backend para coleta e disponibilização dos dados 📜
Stars: ✭ 115 (-29.01%)
Mutual labels:  django, django-rest-framework
Work At Olist
Apply for a job at Olist's Development Team: https://bit.ly/olist-webdev
Stars: ✭ 93 (-42.59%)
Mutual labels:  django, django-rest-framework
Sarenka
OSINT tool - gets data from services like shodan, censys etc. in one app
Stars: ✭ 120 (-25.93%)
Mutual labels:  django, django-rest-framework
Paperweekly forum
paperweekly's forum
Stars: ✭ 118 (-27.16%)
Mutual labels:  django, django-rest-framework
Drf Cheat Sheet
Cheat sheet / quick reference guide for Django REST Framework.
Stars: ✭ 99 (-38.89%)
Mutual labels:  django, django-rest-framework
Django Microservices
UNMAINTAINED
Stars: ✭ 124 (-23.46%)
Mutual labels:  django, django-rest-framework
Django Auth0 Vue
A Django REST Framework + Vue.js CRUD Demo Secured Using Auth0
Stars: ✭ 99 (-38.89%)
Mutual labels:  django, django-rest-framework
Opentpod
Open Toolkit for Painless Object Detection
Stars: ✭ 106 (-34.57%)
Mutual labels:  django, django-rest-framework
Iotdashboard
Fast Django server for IOT Devices
Stars: ✭ 95 (-41.36%)
Mutual labels:  django, django-rest-framework
Bag Of Holding
An application to assist in the organization and prioritization of software security activities.
Stars: ✭ 114 (-29.63%)
Mutual labels:  django, django-rest-framework
Tutorialdb
A search 🔎 engine for programming/dev tutorials, See it in action 👉
Stars: ✭ 93 (-42.59%)
Mutual labels:  django, django-rest-framework
Django rest Vuejs Auth
An Authentication project using JWT Tokens, Vuejs(frontend) and Django-Rest(backend).
Stars: ✭ 92 (-43.21%)
Mutual labels:  django, django-rest-framework
Hydroshare
HydroShare is a collaborative website for better access to data and models in the hydrologic sciences.
Stars: ✭ 117 (-27.78%)
Mutual labels:  django, django-rest-framework
Django Trench
django-trench provides a set of REST API endpoints to supplement django-rest-framework with multi-factor authentication (MFA, 2FA). It supports both standard built-in authentication methods, as well as JWT (JSON Web Token).
Stars: ✭ 123 (-24.07%)
Mutual labels:  django, django-rest-framework

Django gRPC Framework

.. image:: https://img.shields.io/pypi/v/djangogrpcframework.svg :target: https://img.shields.io/pypi/v/djangogrpcframework.svg

.. image:: https://readthedocs.org/projects/djangogrpcframework/badge/?version=latest :target: https://readthedocs.org/projects/djangogrpcframework/badge/?version=latest

.. image:: https://travis-ci.org/fengsp/django-grpc-framework.svg?branch=master :target: https://travis-ci.org/fengsp/django-grpc-framework.svg?branch=master

.. image:: https://img.shields.io/pypi/pyversions/djangogrpcframework :target: https://img.shields.io/pypi/pyversions/djangogrpcframework

.. image:: https://img.shields.io/pypi/l/djangogrpcframework :target: https://img.shields.io/pypi/l/djangogrpcframework

Django gRPC framework is a toolkit for building gRPC services, inspired by djangorestframework.

Requirements

  • Python (3.6, 3.7, 3.8)
  • Django (2.2, 3.0), Django REST Framework (3.10.x, 3.11.x)
  • gRPC, gRPC tools, proto3

Installation

.. code-block:: bash

$ pip install djangogrpcframework

Add django_grpc_framework to INSTALLED_APPS setting:

.. code-block:: python

INSTALLED_APPS = [
    ...
    'django_grpc_framework',
]

Demo

Here is a quick example of using gRPC framework to build a simple model-backed service for accessing users, startup a new project:

.. code-block:: bash

$ django-admin startproject demo
$ python manage.py migrate

Generate .proto file demo.proto_:

.. _demo.proto: https://github.com/fengsp/django-grpc-framework/blob/master/examples/demo/demo.proto

.. code-block:: bash

python manage.py generateproto --model django.contrib.auth.models.User --fields id,username,email --file demo.proto

Generate gRPC code:

.. code-block:: bash

python -m grpc_tools.protoc --proto_path=./ --python_out=./ --grpc_python_out=./ ./demo.proto

Now edit the demo/urls.py module:

.. code-block:: python

from django.contrib.auth.models import User
from django_grpc_framework import generics, proto_serializers
import demo_pb2
import demo_pb2_grpc


class UserProtoSerializer(proto_serializers.ModelProtoSerializer):
    class Meta:
        model = User
        proto_class = demo_pb2.User
        fields = ['id', 'username', 'email']


class UserService(generics.ModelService):
    queryset = User.objects.all()
    serializer_class = UserProtoSerializer


urlpatterns = []
def grpc_handlers(server):
    demo_pb2_grpc.add_UserControllerServicer_to_server(UserService.as_servicer(), server)

That's it, we're done!

.. code-block:: bash

$ python manage.py grpcrunserver --dev

You can now run a gRPC client to access the service:

.. code-block:: python

with grpc.insecure_channel('localhost:50051') as channel:
    stub = demo_pb2_grpc.UserControllerStub(channel)
    for user in stub.List(demo_pb2.UserListRequest()):
        print(user, end='')
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].