To generate a standalone HTML page for a Bokeh application from a single Python script, pass the script name to bokeh html on the command line:
bokeh html
bokeh html app_script.py
The generated HTML will be saved in the current working directory with the name app_script.html.
app_script.html
It is also possible to run the same commmand with jupyter notebooks:
bokeh html app_notebook.ipynb
This will generate an HTML file named app_notebook.html just like with a python script.
app_notebook.html
Applications can also be created from directories. The directory should contain a main.py (and any other helper modules that are required) as well as any additional assets (e.g., theme files). Pass the directory name to bokeh html to generate the HTML:
main.py
bokeh html app_dir
It is possible to generate HTML pages for multiple applications at once:
bokeh html app_script.py app_dir
If you would like to automatically open a browser to display the HTML page(s), you can pass the --show option on the command line:
--show
bokeh html app_script.py app_dir --show
This will open two pages, for app_script.html and app_dir.html, respectively.
app_dir.html
Warning
Applications that use on_change callbacks require using the Bokeh server to execute the callback code.
on_change
HTML
Subcommand to output applications as standalone HTML files.
after_write_file
file_contents
extension
file extension for output generated by this FileOutputSubcommand
FileOutputSubcommand
name
name for this subcommand