Control global configuration options with environment variables. A global settings object that other parts of Bokeh can refer to.
Settings are accessible on the bokeh.settings.settings instance, via accessor methods. For instance:
bokeh.settings.settings
settings.minified()
Bokeh provides the following defined settings:
allowed_ws_origin
List[String]
BOKEH_ALLOW_WS_ORIGIN
[]
(Unset)
A comma-separated list of allowed websocket origins for Bokeh server applications.
auth_module
String
BOKEH_AUTH_MODULE
None
A path to a Python modules that implements user authentication functions for the Bokeh server.
Warning
The contents of this module will be executed!
browser
BOKEH_BROWSER
‘none’
The default browser that Bokeh should use to show documents with.
Valid values are any of the browser names understood by the python standard library webbrowser module.
version
BOKEH_CDN_VERSION
What version of BokehJS to use with CDN resources.
See the Resources class reference for full details.
Resources
cookie_secret
BOKEH_COOKIE_SECRET
Configure the cookie_secret setting in Tornado. This value is required if you use get_secure_cookie or set_secure_cookie. It should be a long, random sequence of bytes
get_secure_cookie
set_secure_cookie
docs_cdn
BOKEH_DOCS_CDN
The version of BokehJS that should be use for loading CDN resources when building the docs.
To build and display the docs using a locally built BokehJS, use local. For example:
local
BOKEH_DOCS_CDN=local make clean serve
Will build a fresh copy of the docs using the locally built BokehJS and open a new browser tab to view them.
Otherwise, the value is interpreted a version for CDN. For example:
BOKEH_DOCS_CDN=1.4.0rc1 make clean
will build docs that use BokehJS version 1.4.0rc1 from CDN.
1.4.0rc1
docs_version
BOKEH_DOCS_VERSION
The Bokeh version to stipulate when building the docs.
This setting is necessary to re-deploy existing versions of docs with new fixes or changes.
ignore_filename
Bool
BOKEH_IGNORE_FILENAME
False
Whether to ignore the current script filename when saving Bokeh content.
log_level
BOKEH_LOG_LEVEL
‘info’
‘debug’
Set the log level for JavaScript BokehJS code.
Valid values are, in order of increasing severity:
trace
debug
info
warn
error
fatal
minified
BOKEH_MINIFIED
True
Whether Bokeh should use minified BokehJS resources.
legacy
BOKEH_LEGACY
Whether Bokeh should use legacy (IE and phantomjs compatible) BokehJS resources.
nodejs_path
BOKEH_NODEJS_PATH
Path to the Node executable.
NodeJS is an optional dependency that is required for PNG and SVG export, and for compiling custom extensions. Bokeh will try to automatically locate an installed Node executable. Use this environment variable to override the location Bokeh finds, or to point to a non-standard location.
validate_doc
BOKEH_VALIDATE_DOC
whether Bokeh should perform validation checks on documents.
Setting this value to False may afford a small performance improvement.
pretty
BOKEH_PRETTY
Whether JSON strings should be pretty-printed.
py_log_level
Log Level
BOKEH_PY_LOG_LEVEL
The log level for Python Bokeh code.
none
resources
BOKEH_RESOURCES
‘cdn’
‘absolute-dev’
What kind of BokehJS resources to configure, e.g inline or cdn
inline
cdn
rootdir
BOKEH_ROOTDIR
Root directory to use with relative resources
relative
secret_key
BOKEH_SECRET_KEY
A long, cryptographically-random secret unique to a Bokeh deployment.
sign_sessions
BOKEH_SIGN_SESSIONS
Whether the Boeh server should only allow sessions signed with a secret key.
If True, BOKEH_SECRET_KEY must also be set.
simple_ids
BOKEH_SIMPLE_IDS
Whether Bokeh should use simple integers for model IDs (starting at 1000).
If False, Bokeh will use UUIDs for object identifiers. This might be needed, e.g., if multiple processes are contributing to a single Bokeh Document.
ssl_certfile
BOKEH_SSL_CERTFILE
The path to a certificate file for SSL termination.
ssl_keyfile
BOKEH_SSL_KEYFILE
The path to a private key file for SSL termination.
ssl_password
BOKEH_SSL_PASSWORD
A password to decrypt the SSL keyfile, if necessary.
strict
BOKEH_STRICT
Whether validation checks should be strict (i.e. raise errors).
xsrf_cookies
BOKEH_XSRF_COOKIES
Whether to enable Tornado XSRF cookie protection on the Bokeh server. This is only applicable when also using an auth module or custom handlers. See
https://www.tornadoweb.org/en/stable/guide/security.html#cross-site-request-forgery-protection
for more information about XSRF protection in Tornado. All PUT, POST, and DELETE handlers will need to be appropriately instrumented when this setting is active.
Setting values are always looked up in the following prescribed order:
These are values that are passed to the setting:
settings.minified(minified_val)
If minified_val is not None, then it will be returned, as-is. Otherwise, if None is passed, then the setting will continute to look down the search order for a value. This is useful for passing optional function paramters that are None by default. If the parameter is passed to the function, then it will take precedence.
minified_val
If the value is set explicity in code:
settings.minified = False
Then this value will take precedence over other sources. Applications may use this ability to set values supplied on the command line, so that they take precedence over environment variables.
Values from a YAML configuration file that is explicitly loaded:
settings.load_config("/path/to/bokeh.yaml)
Any values from bokeh.yaml will take precedence over the sources below. Applications may offer command line arguments to load such a file. e.g. bokeh serve --use-config myconf.yaml
bokeh.yaml
bokeh serve --use-config myconf.yaml
Values found in the associated environment variables:
BOKEH_MINIFIED=no bokeh serve app.py
Bokeh will look for a YAML configuration file in the current user’s home directory ${HOME}/.bokeh/bokeh.yaml.
${HOME}/.bokeh/bokeh.yaml
Future support is planned to load Bokeh settings from global system configurations.
These are default values defined when accessing the setting:
settings.resources(default="server")
Local defaults have lower precendence than every other setting mechanism except global defaults.
These are default values defined by the setting declarations. They have lower precedence than every other setting mechanism.
If no value is obtained after searching all of these locations, then a RuntimeError will be raised.
There are a few methods on the settings object:
settings
Settings
bokehjsdir
The location of the BokehJS source tree.
css_files
The CSS files in the BokehJS directory.
js_files
The JS files in the BokehJS directory.
load_config
Load a user-specified override config file.
The file should be a YAML format with key: value lines.
key: value
secret_key_bytes
Return the secret_key, converted to bytes and cached.