bokeh.server

Provide a customizable Bokeh Server Tornado application.

bokeh.server.server

Provides a Server which instantiates Application instances as clients connect

class Server(applications, **kwargs)

A Server which creates a new Session for each connection, using an Application to initialize each Session.

Parameters:(dict of str (applications) – bokeh.application.Application) or bokeh.application.Application: mapping from URL paths to Application instances, or a single Application to put at the root URL The Application is a factory for Document, with a new Document initialized for each Session. Each application should be identified by a path meant to go in a URL, like “/” or “/foo”
Kwargs:
num_procs (str):
Number of worker processes for an app. Default to one. Using 0 will autodetect number of cores
get_session(app_path, session_id)

Gets a session by name (session must already exist)

get_sessions(app_path)

Gets all live sessions for an application.

show(app_path, browser=None, new='tab')

Opens an app in a browser window or tab.

Useful for testing server applications on your local desktop but should not call when running bokeh-server on an actual server.
Parameters:
  • app_path (str) – the app path to open The part of the URL after the hostname:port, with leading slash.
  • browser (str, optional) – browser to show with (default: None) For systems that support it, the browser argument allows specifying which browser to display in, e.g. “safari”, “firefox”, “opera”, “windows-default” (see the webbrowser module documentation in the standard lib for more details).
  • new (str, optional) – window or tab (default: “tab”) If new is ‘tab’, then opens a new tab. If new is ‘window’, then opens a new window.
Returns:

None

start(start_loop=True)

Start the Bokeh Server’s IO loop and background tasks.

Parameters:start_loop (boolean, optional) – whether to start the IO loop after starting background tasks (default: True).
Returns:None

Notes

Keyboard interrupts or sigterm will cause the server to shut down.

stop()

Stop the Bokeh Server’s IO loop.

Returns:None
unlisten()

Stop listening on ports (Server will no longer be usable after calling this)

Returns:None