1 Star 0 Fork 1

ArthurYan/pywebio-chart-gallery

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
run.py 1.48 KB
一键复制 编辑 原始数据 按行查看 历史
王伟民 提交于 2020-04-17 00:03 . add: plotly demo ✨
import re
from os import path
import tornado.ioloop
import tornado.web
from tornado.options import define, options
from cutecharts_demo import cutecharts
from pyecharts_demo import pyecharts
from plotly_demo import plotly_demo
from pywebio import STATIC_PATH
from pywebio.output import put_markdown, set_auto_scroll_bottom, set_title
from pywebio.platform.tornado import webio_handler
def index():
set_title("PyWebIO Chart Gallery")
set_auto_scroll_bottom(False)
readme_file = path.join(path.dirname(__file__), "README.md")
readme = open(readme_file).read()
readme = re.sub(r"\[\*\*demos\*\*\]\(.*?\?pywebio_api=(.+?)\)", r"[**demos**](./?pywebio_api=\g<1>)", readme)
cdn = r"https://cdn.jsdelivr.net/gh/wang0618/pywebio-chart-gallery@master"
readme = re.sub(r"!\[(.+?)\]\(.*?(.+?)\)", r"![\g<1>](%s\g<2>)" % cdn, readme)
readme = re.sub(r"<div></div>[\s\S]*$", "", readme)
put_markdown(readme)
if __name__ == "__main__":
define("port", default=8080, help="run on the given port", type=int)
tornado.options.parse_command_line()
application = tornado.web.Application([
(r"/io", webio_handler(index)),
(r"/cutecharts", webio_handler(cutecharts)),
(r"/pyecharts", webio_handler(pyecharts)),
(r"/plotly", webio_handler(plotly_demo)),
(r"/(.*)", tornado.web.StaticFileHandler, {"path": STATIC_PATH, 'default_filename': 'index.html'})
])
application.listen(port=options.port)
tornado.ioloop.IOLoop.current().start()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/arthuryan669/pywebio-chart-gallery.git
git@gitee.com:arthuryan669/pywebio-chart-gallery.git
arthuryan669
pywebio-chart-gallery
pywebio-chart-gallery
master

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385