Search code examples
httppython-asyncioaiohttp

aiohttp: Serve single static file


How to serve a single static file (instead of an entire directory) using aiohttp?

Static file serving seems to be baked into the routing system with UrlDispatcher.add_static(), but this only serves entire directories.

(I know that I eventually should use something like nginx to serve static files in a production environment.)


Solution

  • Currently there is no built-in way of doing this; however, there are plans in motion to add this feature.