Spaces:
Runtime error
Runtime error
File size: 518 Bytes
badef93 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 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)
|