#! @python@/bin/python -B import os from aiohttp import web import yaml CONF_FILE = os.getenv('CONFIG', '/etc/qclk/config.yaml') conf_k = web.AppKey('config', dict) def log(m): print(m, file=sys.stderr) routes = web.RouteTableDef() @routes.get('/') async def index(req): return web.Response(text='Hello, world!') def main(): app = web.Application() with open(CONF_FILE) as f: app[conf_k] = yaml.safe_load(f) app.add_routes(routes) web.run_app(app, port=8080) if __name__ == '__main__': main()