ServerAdapters
Django Adapter
Mount pyRPC on a Django application using mount_django.
Django Adapter
The Django adapter exposes your pyRPC procedures on a Django application with native async views.
Installation
uv add pyrpc-core[django]Or install directly:
uv add pyrpc-django-adapterBasic Setup
# app/views.py
from pyrpc_core import rpc
@rpc
def add(a: int, b: int) -> int:
return a + b# app/urls.py
from django.urls import path
from pyrpc_django import mount_django
urlpatterns = [
*mount_django(),
]How It Works
@rpcregisters functions in the global registry.mount_django()returns a list of URL patterns:POST /rpc— dispatch procedure callsGET /rpc— introspection (schema)
- The adapter uses Django's native
async defviews — noanyio.runbridge needed.
Custom Router
from pyrpc_core import Router
from pyrpc_django import mount_django
router = Router()
router.register(...)
urlpatterns = [
*mount_django(router=router),
]Requirements
- Django 4.2+ (for async view support)

pyRPC