Environment Variables
The server will check a number of environment variables to configure itself.
Setting Environment variables
Environment variables can be set in many ways depending on the the OS and/or the tool used to launch the server. This is a list of common possible ways:
Windows Powershell:
$env:VARIABLE_NAME = "value"
(code must be run in the same shell)Windows Command Prompt:
set VARIABLE_NAME=value
(code must be run in the same shell) !! Do not use quotes as they will be included in the valueWindows Settings:
Control Panel > System > Advanced System Settings > Environment Variables
Linux BASH:
export VARIABLE_NAME=value
(code must be run in the same shell)VSCode:
launch.json > env > VARIABLE_NAME
{
"version": "0.2.0",
"configurations": [
{
...
"env": {
"VARIABLE_NAME_1": "VALUE_1",
...
},
...
}
]
}
Docker:
docker run -e VARIABLE_NAME=value ...
Docker:
docker run --env-file .env ...
where .env is a file with the format
VARIABLE_NAME_1=VALUE_1
...
VARIABLE_NAME_N=VALUE_N
App variable List
Variables used by the application.
Variable |
Default |
Usage |
---|---|---|
|
Default set to the downloaded release version Version the Can be either a version number ( |
|
|
false |
If true, the server will attempt to update the main package to the version specified by |
|
false |
Path to the base directory of the project. If no other paths are configured using environment variables, the server database, plugin files and downloaded models will be stored here. |
|
false |
source/destination languages and most used models for that language combination at server start |
|
false |
Will force the server to automatically create/update the Language entries in the database. |
|
cpu |
Which device to use for plugins that support it. Currently allowed: cpu, cuda |
|
4 |
Number of WorkerMessageQueue workers handling incoming OCR_TSL post requests |
|
1 |
Number of WorkerMessageQueue workers handling box_ocr pipelines (Should be set as 1 until the pipeline is build to handle multiple concurrent request efficiently without slowdowns) |
|
1 |
Number of WorkerMessageQueue workers handling ocr pipelines (Should be set as 1 until the pipeline is build to handle multiple concurrent request efficiently without slowdowns) |
|
1 |
Number of WorkerMessageQueue workers handling translation pipelines (Should be set as 1 until the pipeline is build to handle multiple concurrent request efficiently without slowdowns) |
run_server.py variable List
This variables are used if running the server using the provided run_server.py script. This includes the windows release file and docker image that are based on the same script.
Variable |
Default |
Usage |
---|---|---|
|
admin |
Username for the superuser to be created |
|
password |
Password for the superuser to be created |
|
false |
Allow setting of CORS headers in the server responses |
|
List of semi-colon CSRF_TRUSTED_ORIGINS is set to the same value (can use this with USE_CORS_HEADERS=false) to set CSRF_TRUSTED_ORIGINS only EXAMPLE: |
|
|
LIB default |
List of semi-colon EXAMPLE: |
|
LIB default |
List of semi-colon EXAMPLE: |
|
127.0.0.1 |
Address to bind the server to |
|
4000 |
Port the server will listen to |
|
current user |
User to run the server as if using gunicorn. |
|
1200 |
Timeout for gunicorn workers |
|
1 |
Number of gunicorn workers |
Plugin specific variables
See plugins doc
Server variable List
Variables used specifically by the DJANGO server.
Variable |
Default |
Usage |
---|---|---|
|
false |
Whether to run the server in debug (true) or production (false) mode |
|
INFO |
python logging level.
See logging_docs for allowed values
|
|
optional |
Add list of semi-colon
; separated IPs to the ALLOWED_HOSTS of the server. Needed if you want to host the server on a different machine than the one querying it.
EXAMPLE:
DJANGO_ALLOWED_HOSTS="192.168.1.1;172.108.104.3" SEE Django Documentation for more info.
|
|
db.sqlite3 |
For sqlite3 this is the path to the database file. For other backend it should be the name of the database |
|
django.db.backends.sqlite3 |
Change this to either a Django or 3rd party provided backend to use another Database type |
|
optional |
Required if using another db back-end |
|
optional |
Required if using another db back-end |
|
optional |
Probably required if using another db back-end |
|
optional |
Probably required if using another db back-end |