web中间件,在请求静态目录时提供索引文件(例如index.html)。
aiohttp-index的Python项目详细描述
aiohttp.web中间件到 在请求静态目录时提供索引文件(例如index.html)。
用法
fromaiohttpimportwebfromaiohttp_indeximportIndexMiddlewareapp=web.Application(middlewares=[IndexMiddleware()])app.router.add_static('/','static')
app现在将在请求/时为static/index.html服务。
依赖关系
- Python3.5+
- aiohttp(测试时间 0.21.4)