随笔分类 -  sanic框架

sanic 类视图
摘要:from sanic import Sanic from sanic.response import json from sanic.websocket import WebSocketProtocol # app = Sanic("websocket_example") from sanic im 阅读全文

posted @ 2021-06-16 12:20 HHMLXL 阅读(46) 评论(0) 推荐(0) 编辑

sanic websocket
摘要:from sanic import Sanic from sanic.response import json from sanic.websocket import WebSocketProtocol app = Sanic("websocket_example") @app.websocket( 阅读全文

posted @ 2021-06-16 11:57 HHMLXL 阅读(104) 评论(0) 推荐(0) 编辑

sanic版本
摘要:# 版本,Blueprint('/',version=1) # http://127.0.0.1:8000/v1 # 在蓝图中也可添加 from sanic import Sanic from sanic.response import json app=Sanic("app") @app.post 阅读全文

posted @ 2021-06-16 11:13 HHMLXL 阅读(76) 评论(0) 推荐(0) 编辑

sanic蓝图
摘要:'''蓝图层次结构化路由,将应用程序逻辑划分为多个组或职责区域,类似于django多个app的url.py和setting.py的url.py例如:不同模块负责不同功能,路由前缀不同/api/t/?name="aw"/api/s/?name="sw"注册蓝图t=Blueprint('t',url_p 阅读全文

posted @ 2021-06-16 10:42 HHMLXL 阅读(98) 评论(0) 推荐(0) 编辑

sanic 路由
摘要:from sanic import Sanic from sanic.response import json,file app=Sanic("app") # @app.route('/',methods=['POST']) async def test(request): name=request 阅读全文

posted @ 2021-06-16 10:26 HHMLXL 阅读(55) 评论(0) 推荐(0) 编辑

sanic请求响应
摘要:# pip install sanic from sanic import Sanic from sanic.response import json,file app=Sanic("app") ''' 请求 get 获取参数 request.args.get("") post 获取参数 reque 阅读全文

posted @ 2021-06-16 10:00 HHMLXL 阅读(209) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示