This docs on this page refers to a PREVIOUS VERSION. For the latest stable release, go to https://docs.bokeh.org/

Archived docs for versions <= 1.0.4 have had to be modified from their original published configuration, and may be missing some features (e.g. source listing)

All users are encourage to update to version 1.1 or later, as soon as they are able.

bokeh.application.handlers.code — Bokeh 0.12.11 documentation

bokeh.application.handlers.code

Provide a Bokeh Application Handler to build up documents by compiling and executing Python source code.

This Handler is used by the Bokeh server command line tool to build applications that run off scripts and notebooks.

def make_doc(doc):

    # do work to modify the document, add plots, widgets, etc.

    return doc

app = Application(FunctionHandler(make_doc))

server = Server({'/bkapp': app}, io_loop=IOLoop.current())

server.start()
class CodeHandler(*args, **kwargs)[source]

Run source code which modifies a Document

__init__(*args, **kwargs)[source]
Parameters:
  • source (str) – python source code
  • filename (str) – a filename to use in any debugging or error output
  • argv (list[str], optional) – a list of string arguments to make available as sys.argv when the code executes
modify_document(doc)[source]
url_path()[source]

The last path component for the basename of the configured filename.

error

If the handler fails, may contain a related error message.

error_detail

If the handler fails, may contain a traceback or other details.

failed

True if the handler failed to modify the doc

safe_to_fork

Whether it is still safe for the Bokeh server to fork new workers.

False if the code has already been executed.