本文整理汇总了Python中bokeh.embed.server_document方法的典型用法代码示例。如果您正苦于以下问题:Python embed.server_document方法的具体用法?Python embed.server_document怎么用?Python embed.server_document使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bokeh.embed
的用法示例。
在下文中一共展示了embed.server_document方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from bokeh import embed [as 别名]
# 或者: from bokeh.embed import server_document [as 别名]
def get(self, session_id, graph_key):
session_name = session_id
template = _jinja_env.get_template('task_pages/progress.html')
task_progress_script = server_document(
'%s://%s/%s' % (self.request.protocol, self.request.host, PROGRESS_APP_NAME),
arguments=dict(session_id=session_id, task_id=graph_key))
self.write(template.render(
session_id=session_id,
session_name=session_name,
task_id=graph_key,
task_progress_script=task_progress_script,
))
示例2: get
# 需要导入模块: from bokeh import embed [as 别名]
# 或者: from bokeh.embed import server_document [as 别名]
def get(self, endpoint):
template = _jinja_env.get_template('worker_pages/timeline.html')
worker_timeline_script = server_document(
'%s://%s/%s' % (self.request.protocol, self.request.host, TIMELINE_APP_NAME),
arguments=dict(endpoint=endpoint))
self.write(template.render(
endpoint=endpoint,
host_name=_worker_host_cache.get(endpoint, endpoint),
worker_timeline_script=worker_timeline_script,
))
示例3: sliders
# 需要导入模块: from bokeh import embed [as 别名]
# 或者: from bokeh.embed import server_document [as 别名]
def sliders(request):
return render(request, 'base.html', {
"server_script": server_document('http://%s:%s/bk_sliders_app'%(bk_config.server['address'],
bk_config.server['port']))})
示例4: get
# 需要导入模块: from bokeh import embed [as 别名]
# 或者: from bokeh.embed import server_document [as 别名]
def get(self):
print("index ...")
template = env.get_template('bokeh_embed.html')
script = server_document(server_url + 'bkapp')
print(script)
self.write(template.render(script=script, template="Tornado"))
# self.write(html_content)
示例5: __init__
# 需要导入模块: from bokeh import embed [as 别名]
# 或者: from bokeh.embed import server_document [as 别名]
def __init__(self):
print("creating new app")
self.flask_app = Flask('__main__') # use '__main__' because this script is the top level
# GET routine for root page
@self.flask_app.route('/', methods=['GET']) # going to http://localhost:5006 or whatever will trigger this route
def bkapp_page():
script = server_document(url='http://localhost:5006/bkapp')
return render_template('index.html', script=script)
示例6: index
# 需要导入模块: from bokeh import embed [as 别名]
# 或者: from bokeh.embed import server_document [as 别名]
def index():
# format
# name-of-js-to-add = server_document(url="http://localhost:5006/<py file that generate the graph and updates it>")
client_demo_script=server_document(url="http://localhost:5006/client_demo")
# script2=server_document(url="http://localhost:5006/update2")
return render_template('client-demo.html', client_plot=client_demo_script)
示例7: sliders
# 需要导入模块: from bokeh import embed [as 别名]
# 或者: from bokeh.embed import server_document [as 别名]
def sliders(request: HttpRequest) -> HttpResponse:
script = server_document(request.build_absolute_uri())
return render(request, "base.html", dict(script=script))
示例8: gbm
# 需要导入模块: from bokeh import embed [as 别名]
# 或者: from bokeh.embed import server_document [as 别名]
def gbm(request: HttpRequest) -> HttpResponse:
script = server_document(request.build_absolute_uri())
return render(request, "gbm/gbm.html", dict(script=script))
示例9: stockscreener
# 需要导入模块: from bokeh import embed [as 别名]
# 或者: from bokeh.embed import server_document [as 别名]
def stockscreener(request: HttpRequest) -> HttpResponse:
script = server_document(request.build_absolute_uri())
return render(request, "stockscreener/stockscreener.html", dict(script=script))
示例10: sliders
# 需要导入模块: from bokeh import embed [as 别名]
# 或者: from bokeh.embed import server_document [as 别名]
def sliders(request: HttpRequest) -> HttpResponse:
script = server_document(request.build_absolute_uri())
return render(request, "sliders/sliders.html", dict(script=script))
示例11: bokeh_row
# 需要导入模块: from bokeh import embed [as 别名]
# 或者: from bokeh.embed import server_document [as 别名]
def bokeh_row(request, job_id, type='individual-graph'):
"""
Returns an embeded bokeh document in json. Javascript can use this method to inject bokeh document to jobs table.
"""
try:
job = TethysJob.objects.get_subclass(id=job_id)
status = job.status
# Get dashboard link for a given job_id
scheduler_id = job.scheduler_id
dask_scheduler = DaskScheduler.objects.get(id=scheduler_id)
base_link = dask_scheduler.dashboard
# Append http if not exists
if 'http' not in base_link:
base_link = 'http://' + base_link
# Add forward slash if not exist
if base_link[-1] != '/':
base_link = base_link + '/'
# use bokeh server_document to embed
url_link = base_link + type
script = server_document(url_link)
context = {"the_script": script}
success = True
except Exception as e:
log.error('The following error occurred when getting bokeh chart '
'from scheduler {} for job {}: {}'.format(dask_scheduler.name, job_id, str(e)))
return
# Render bokeh app into a string to pass in JsonResponse
html = render_to_string('tethys_gizmos/gizmos/bokeh_application.html', context)
return JsonResponse({'success': success, 'status': status, 'html': html})
示例12: show_server
# 需要导入模块: from bokeh import embed [as 别名]
# 或者: from bokeh.embed import server_document [as 别名]
def show_server(panel, notebook_url, port):
"""
Displays a bokeh server inline in the notebook.
Arguments
---------
panel: Viewable
Panel Viewable object to launch a server for
notebook_url: str
The URL of the running Jupyter notebook server
port: int (optional, default=0)
Allows specifying a specific port
server_id: str
Unique ID to identify the server with
Returns
-------
server: bokeh.server.Server
"""
from IPython.display import publish_display_data
if callable(notebook_url):
origin = notebook_url(None)
else:
origin = _origin_url(notebook_url)
server_id = uuid.uuid4().hex
server = get_server(panel, port=port, websocket_origin=origin,
start=True, show=False, server_id=server_id)
if callable(notebook_url):
url = notebook_url(server.port)
else:
url = _server_url(notebook_url, server.port)
script = server_document(url, resources=None)
publish_display_data({
HTML_MIME: script,
EXEC_MIME: ""
}, metadata={
EXEC_MIME: {"server_id": server_id}
})
return server