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: Document):
# 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(*, source: str, filename: PathLike, argv: List[str] = [], package: ModuleType | None = None)[source]#
Run source code which modifies a Document
Public Data Attributes:
If the handler fails, may contain a related error message.
If the handler fails, may contain a traceback or other details.
True
if the handler failed to modify the docWhether it is still safe for the Bokeh server to fork new workers.
Inherited from
Handler
If the handler fails, may contain a related error message.
If the handler fails, may contain a traceback or other details.
True
if the handler failed to modify the docWhether it is still safe for the Bokeh server to fork new workers.
Public Methods:
__init__
(*, source, filename[, argv, package])- param source
python source code
modify_document
(doc)Run Bokeh application code to update a
Document
url_path
()The last path component for the basename of the configured filename.
Inherited from
Handler
__init__
(*, source, filename[, argv, package])- param source
python source code
modify_document
(doc)Run Bokeh application code to update a
Document
on_server_loaded
(server_context)Execute code when the server is first started.
on_server_unloaded
(server_context)Execute code when the server cleanly exits.
on_session_created
(session_context)Execute code when a new session is created.
on_session_destroyed
(session_context)Execute code when a session is destroyed.
process_request
(request)Processes incoming HTTP request returning a dictionary of additional data to add to the session_context.
static_path
()Return a path to app-specific static resources, if applicable.
url_path
()The last path component for the basename of the configured filename.
- __init__(*, source: str, filename: PathLike, argv: List[str] = [], package: ModuleType | None = None) None [source]#
- modify_document(doc: Document) None [source]#
Run Bokeh application code to update a
Document
- Parameters
doc (Document) – a
Document
to update