提交 be108ce6 编写于 作者: 金晖's avatar 金晖

新增路由

上级 c779bd1e
流水线 #51990 已取消 于阶段
# This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
import pywebio
from model.test import main
import tornado.ioloop
import tornado.web
from pywebio.platform.tornado import webio_handler
def print_hi(name):
# Use a breakpoint in the code line below to debug your script.
print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint.
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world")
if __name__ == "__main__":
application = tornado.web.Application([
(r"/", MainHandler),
(r"/web/create", webio_handler(main)), # `task_func` is PyWebIO task function
])
application.listen(port=8889, address='localhost')
tornado.ioloop.IOLoop.current().start()
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
pywebio.start_server(main, port=8889, debug=True, cdn=False, auto_open_webbrowser=True)
# if __name__ == '__main__':
# pywebio.start_server(main, port=8889, debug=True, cdn=False, auto_open_webbrowser=True)
# See PyCharm help at https://www.jetbrains.com/help/pycharm/
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册