django-grpc-framework icon indicating copy to clipboard operation
django-grpc-framework copied to clipboard

howto register multiple grpc handlers from multiple apps in one django project ?

Open markdoerr opened this issue 3 years ago • 1 comments

I have a django project with > 10 different apps, each having a gRPC interface. What is the cleanest way to register all gRPC handlers in your framework ? It would be nice, if I could use the GRPC_FRAMEWORK settings for that, but it currently has only a GRPC_ROOT_HANDLERS hook, which points to one module.

What about adding there a list of GRPC_HANDLERS ? Example:

GRPC_FRAMEWORK = { 'GRPC_HANDLERS': ['app1.grpc_interface.handlers', 'app2.grpc_interface.handlers', ...] } This would allow to add new handlers even with environment variables, e.g. for configuring a complex django project.

markdoerr avatar Sep 12 '22 09:09 markdoerr

Hi, the way we usually do it is that we have one single main handler which imports the handlers of all the other apps. However using a list directly in the settings would be a great enhancement imo

This lib is not maintained anymore, I suggest you take a look into https://github.com/socotecio/django-socio-grpc which we do maintain and post this issue there

legau avatar Sep 29 '22 15:09 legau