You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
767 B

#!/usr/bin/env python3
import asyncio
from aiohttp import web
from autogestionale.config import Config
from autogestionale.logging import setup_logging, get_logger
from autogestionale.database import Database
from autogestionale.routes import setup_routes
log = get_logger('web')
def setup_app(loop, config):
app = web.Application(loop=loop)
app['config'] = config
app['db'] = Database(**config.core['DATABASE'])
setup_routes(app)
return app
if __name__ == '__main__':
config = Config()
setup_logging(config.logging)
loop = asyncio.get_event_loop()
app = setup_app(loop, config)
web.run_app(app,
host=config.core.get('GENERAL', 'Address'),
port=config.core.getint('GENERAL', 'Port'))