aiohttp_index¶
aiohttp.web middleware to serve index files (e.g. index.html) when static directories are requested.
Contents¶
-
aiohttp_index.
IndexMiddleware
(index='index.html')[source]¶ Middleware to serve index files (e.g. index.html) when static directories are requested.
Usage:
from aiohttp import web from aiohttp_index import IndexMiddleware app = web.Application(middlewares=[IndexMiddleware()]) app.router.add_static('/', 'static')
app
will now servestatic/index.html
when/
is requested.Parameters: index (str) – The name of a directory’s index file. Returns: The middleware factory. Return type: function