import web import random routes = web.RouteTableDef() @routes.get("/ghost.png") #get_page = routes.get("/ghost.png")(get_img_spook) async def get_img_spook(request: web.Request) -> web.Response: return web.Response(body=open('spooky/ghost.png','rb').read(), content_type='image/png') @routes.get("/") #get_page = routes.get("/")(get_page) async def get_page(request: web.Request) -> web.Response: return web.Response(text=open('spooky/index.html').read(), content_type='text/html; charset=utf-8') if __name__ == '__main__': app = web.Application() app.add_routes(routes) web.run_app(app) # this function never returns