This example will help you integrate ONLYOFFICE Docs into your web application written on Python.
Please keep in mind the following security aspects when you are using test examples:
The Python example offers various installation options, but we highly recommend using Docker for this purpose.
Option 1. Using Docker
To run the example using Docker, you will need Docker Desktop 4.17.0 or Docker Engine 20.10.23 with Docker Compose 2.15.1. Additionally, you might want to consider installing GNU Make 4.4.1, although it is optional. These are the minimum versions required for the tools.
Once you have everything installed, download the release archive and unarchive it:
curl --output Python.Example.zip --location https://github.com/ONLYOFFICE/document-server-integration/releases/latest/download/Python.Example.zip unzip Python.Example.zip
Then open the example directory and up containers:
cd "Python Example" make compose-prod
By default, the server starts at localhost:80.
To configure the example, you can edit the environment variables in compose-base.yml. See below for more information about environment variables.
Option 2. On local machine
Download and install ONLYOFFICE Docs (packaged as Document Server):
Check the detailed guide to learn how to install it on Windows, Linux, or Docker.
To run the example on your local machine, you will need Python 3.11.4 with pip 23.1.2. Additionally, you might want to consider installing GNU Make 4.4.1, although it is optional. These are the minimum versions required for the tools.
Once you have everything installed, download the release archive and unarchive it:
curl --output Python.Example.zip --location https://github.com/ONLYOFFICE/document-server-integration/releases/latest/download/Python.Example.zip unzip Python.Example.zip
Then open the example directory, install dependencies, and start the server:
cd "Python Example" make prod make server-prod
By default, the server starts at 0.0.0.0:8000.
To configure the example, you can pass the environment variables before the command that starts the server. See below for more information about environment variables.
In case the example and ONLYOFFICE Docs are installed on different computers, make sure that your server with the example installed has access to the ONLYOFFICE Docs with the address which you specify instead of documentserver in the configuration files.
Make sure that the ONLYOFFICE Docs in its turn has access to the server with the example installed with the address which you specify instead of example.com in the configuration files.
The example is configured by changing environment variables.
Parameter | Description | Example |
DEBUG | Disable or enable debug mode. | false |
ADDRESS | The address where the server should be started. | 0.0.0.0 |
PORT | The port on which the server should be running. | 80 |
DOCUMENT_SERVER_PRIVATE_URL | The URL through which the server will communicate with ONLYOFFICE Docs | http://proxy:8080 |
DOCUMENT_SERVER_PUBLIC_URL | The URL through which a user will communicate with ONLYOFFICE Docs. | http://localhost:8080 |
EXAMPLE_URL | The URL through which ONLYOFFICE Docs will communicate with the server. | http://proxy |
JWT_SECRET | JWT authorization secret. Leave blank to disable authorization. | your-256-bit-secret |
If you integrated the editors successfully the result should look like the demo preview on our site.