How to Integrate OnlyOffice Document Server with Django via Docker Compose? (Seeking Configuration Guide/Example)

Document Server version: 9.x.x

Type of installation of the Document Server: Docker (onlyoffice/documentserver via Docker Compose)

OS: Windows 11 (Docker Desktop)

Browser version: Any modern browser (Chrome/Firefox/Edge)

Additional information: I am building a backend system using Django and Django REST Framework, and I want to integrate OnlyOffice Document Serverto view my docs. I am looking for a complete, working blueprint or guide using Docker Compose to orchestrate both the Django application container and the OnlyOffice Document Server container.

Specifically, I need guidance on:

  1. Docker Compose Configuration: How to properly structure the docker-compose.yml file so both services can communicate reliably over an internal Docker network, including handling port mapping.

  2. JWT Security Configuration: How to correctly configure and synchronize the shared JWT secret (JWT_SECRET, JWT_HEADER) between the Django backend settings and the OnlyOffice container environment variables to secure the callbacks.

and how to persist configurations also , and ensure server to server communication between django and onlyoffice

Hi @greatios,

Before diving into code, I’d recommend reading the How it works overview to understand the architecture — what Document Server provides vs what the integrator (your Django app) must implement: How it works | ONLYOFFICE

Then, for a practical implementation, check our integration examples — we have ready-to-run samples for multiple languages: Docs API integration samples | ONLYOFFICE

It’s not Django-specific, but the integration logic (JWT signing, callback handling, editor config) is directly applicable to Django/DRF.

A few key concepts to keep in mind:

  • You’ll need two URLs for Document Server — a public one (for the browser to load the JS API) and an internal one using the Docker service name (for server-to-server requests). The example uses DOCUMENT_SERVER_PUBLIC_URL and DOCUMENT_SERVER_PRIVATE_URL for this.
  • For JWT, use Docker environment variables (JWT_ENABLED, JWT_SECRET) on the DS container, and sign the editor config on the Django side with the same secret using PyJWT. Details: Signature | ONLYOFFICE

I’d recommend running the Python example first (make compose-prod), then adapting its logic into your Django project.