python-dependency-injector/examples/miniapps/sanic/giphynavigator/application.py
2020-09-23 18:29:13 -04:00

23 lines
474 B
Python

"""Application module."""
from sanic import Sanic
from .containers import Container
from . import handlers
def create_app():
"""Create and return aiohttp application."""
container = Container()
container.config.from_yaml('config.yml')
container.config.giphy.api_key.from_env('GIPHY_API_KEY')
container.wire(modules=[handlers])
app = Sanic('Giphy Navigator')
app.container = container
app.add_route(handlers.index, '/')
return app