import os from aiohttp import web async def handle(request): path = request.match_info.get('path', '') if not path or path == '/': path = 'index.html' file_path = os.path.join('static', path) if os.path.isfile(file_path): return web.FileResponse(file_path) return web.Response(text='Not found', status=404) app = web.Application() app.router.add_get('/{path:.*}', handle) app.router.add_get('/', handle) if __name__ == '__main__': web.run_app(app, host='0.0.0.0', port=7860)