How to integrate online editors into your own website on Python
The integration examples are used to demonstrate document editors functions and the ways to connect Document Server to your own application. DO NOT USE these examples on your own server without PROPER CODE MODIFICATIONS! If you enabled any of the test examples, disable it before going for production.
Please keep in mind the following security aspects when you are using test examples:
- There is no protection of the storage from unauthorized access since there is no need for authorization.
- There are no checks against parameter substitution in links, since the parameters are generated by the code according to the pre-arranged scripts.
- There are no data checks in requests of saving the file after editing, since each test example is intended for requests only from ONLYOFFICE Document Server.
- There are no prohibitions on using test examples from other sites, since they are intended to interact with ONLYOFFICE Document Server from another domain.
Download and install (packaged as Document Server).
See the detailed guide to learn how to install Document Server for Windows, , or for Docker.
Download the archive with the Python example and unpack the archive:
wget “https://api.onlyoffice.com/app\_data/editor/Python%20Example.zip“
Change the current directory for the project directory:
cd Python\ Example
Install the dependencies:
pip install Django==3.1.3 pip install requests==2.25.0 pip install pyjwt==2.6.0 pip install python-magic
Edit the config.py configuration file. Specify the name of your local server with the ONLYOFFICE Document Server installed. And specify the name of the server on which example is installed.
nano config.py
where the documentserver is the name of the server with the ONLYOFFICE Document Server installed and the STORAGE_PATH is the path where files will be created and stored. You can set an absolute path. For example, D:\\folder. Please note that on Windows OS the double backslash must be used as a separator.
See the result in your browser using the address:
In case the example and Document Server are installed on different computers, make sure that your server with the example installed has access to the Document Server with the address which you specify instead of documentserver in the configuration files. Make sure that the Document Server in its turn has access to the server with the example installed with the address which you specify instead of exampleserver in the configuration files.