1 Star 1 Fork 0

alitrack / fab-dash

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
run.py 1.22 KB
一键复制 编辑 原始数据 按行查看 历史
Steven Lee 提交于 2022-11-10 22:27 . more examples
try:
import asyncio
except ImportError:
raise RuntimeError("This example requries Python3 / asyncio")
import os
from threading import Thread
from bokeh.server.server import BaseServer
from bokeh.server.tornado import BokehTornado
import panel as pn
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from app import sockets,app,apps,appbuilder
def bk_worker():
asyncio.set_event_loop(asyncio.new_event_loop())
bokeh_tornado = BokehTornado(
apps, extra_websocket_origins=["127.0.0.1:8000"]
)
bokeh_http = HTTPServer(bokeh_tornado)
bokeh_http.add_sockets(sockets)
server = BaseServer(IOLoop.current(), bokeh_tornado, bokeh_http)
server.start()
server.io_loop.start()
t = Thread(target=bk_worker)
t.daemon = True
t.start()
if __name__ == "__main__":
print("This script is intended to be run with gunicorn. e.g.")
print()
print(" gunicorn -w 4 run:app --reload")
print()
print("will start the app on four processes")
app.run(host="0.0.0.0", port=8000, debug=True)
# import sys
# sys.exit()
# apps['fab']=appbuilder
# pn.serve(apps,
# port=8000, allow_websocket_origin=["127.0.0.1:8000"],
# address="127.0.0.1", show=False)
Python
1
https://gitee.com/alitrack/fab-dash.git
git@gitee.com:alitrack/fab-dash.git
alitrack
fab-dash
fab-dash
master

搜索帮助