aiohttp_index

aiohttp.web middleware to serve index files (e.g. index.html) when static directories are requested.

Dependencies

  • Python 3.5+
  • aiohttp (tested on 0.21.4)

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 serve static/index.html when / is requested.

Parameters:index (str) – The name of a directory’s index file.
Returns:The middleware factory.
Return type:function

Indices and tables