|
@@ -16,10 +16,10 @@ from tornado.options import define, options
|
|
|
|
|
|
index_md = r"""### 基本demo
|
|
|
|
|
|
- - [BMI计算](./?pywebio_api=bmi): 根据身高体重计算BMI指数 [源码](https://github.com/wang0618/PyWebIO/blob/dev/demos/bmi.py)
|
|
|
- - [聊天室](./?pywebio_api=chat_room): 和当前所有在线的人聊天 [源码](https://github.com/wang0618/PyWebIO/blob/dev/demos/chat_room.py)
|
|
|
- - [输入演示](./?pywebio_api=input_usage): 演示PyWebIO输入模块的用法 [源码](https://github.com/wang0618/PyWebIO/blob/dev/demos/input_usage.py)
|
|
|
- - [输出演示](./?pywebio_api=output_usage): 演示PyWebIO输出模块的用法 [源码](https://github.com/wang0618/PyWebIO/blob/dev/demos/output_usage.py)
|
|
|
+ - [BMI计算](./bmi): 根据身高体重计算BMI指数 [源码](https://github.com/wang0618/PyWebIO/blob/dev/demos/bmi.py)
|
|
|
+ - [聊天室](./chat_room): 和当前所有在线的人聊天 [源码](https://github.com/wang0618/PyWebIO/blob/dev/demos/chat_room.py)
|
|
|
+ - [输入演示](./input_usage): 演示PyWebIO输入模块的用法 [源码](https://github.com/wang0618/PyWebIO/blob/dev/demos/input_usage.py)
|
|
|
+ - [输出演示](./output_usage): 演示PyWebIO输出模块的用法 [源码](https://github.com/wang0618/PyWebIO/blob/dev/demos/output_usage.py)
|
|
|
- 更多Demo请见[文档](https://pywebio.readthedocs.io)中示例代码的在线Demo
|
|
|
|
|
|
### 数据可视化demo
|
|
@@ -56,6 +56,10 @@ PyWebIO还支持使用第三方库进行数据可视化
|
|
|
|
|
|
|
|
|
def index():
|
|
|
+ """PyWebIO demos
|
|
|
+
|
|
|
+ PyWebIO的基本demo和数据可视化demo
|
|
|
+ """
|
|
|
style(put_row([
|
|
|
put_markdown('# PyWebIO demos'),
|
|
|
put_html('<a class="github-button" data-size="large" href="https://github.com/wang0618/PyWebIO" data-show-count="true" aria-label="Star wang0618/PyWebIO on GitHub">Star</a>')
|
|
@@ -70,13 +74,13 @@ if __name__ == "__main__":
|
|
|
tornado.options.parse_command_line()
|
|
|
|
|
|
application = tornado.web.Application([
|
|
|
- (r"/io", webio_handler(index)),
|
|
|
- (r"/bmi", webio_handler(bmi)),
|
|
|
- (r"/chat_room", webio_handler(chat_room)),
|
|
|
- (r"/input_usage", webio_handler(input_usage)),
|
|
|
- (r"/output_usage", webio_handler(output_usage)),
|
|
|
- (r"/doc_demo", webio_handler(get_doc_demo_app())),
|
|
|
- (r"/set_env_demo", webio_handler(set_env_demo)),
|
|
|
+ (r"/", webio_handler(index, cdn=False)),
|
|
|
+ (r"/bmi", webio_handler(bmi, cdn=False)),
|
|
|
+ (r"/chat_room", webio_handler(chat_room, cdn=False)),
|
|
|
+ (r"/input_usage", webio_handler(input_usage, cdn=False)),
|
|
|
+ (r"/output_usage", webio_handler(output_usage, cdn=False)),
|
|
|
+ (r"/doc_demo", webio_handler(get_doc_demo_app(), cdn=False)),
|
|
|
+ (r"/set_env_demo", webio_handler(set_env_demo, cdn=False)),
|
|
|
(r"/(.*)", tornado.web.StaticFileHandler, {"path": STATIC_PATH, 'default_filename': 'index.html'})
|
|
|
])
|
|
|
application.listen(port=options.port)
|