python-dependency-injector/examples/miniapps/giphynav-aiohttp/giphynavigator/application.py
2020-07-30 13:52:42 -04:00

22 lines
484 B
Python

"""Application module."""
from aiohttp import web
from .containers import ApplicationContainer
def create_app():
"""Create and return aiohttp application."""
container = ApplicationContainer()
container.config.from_yaml('config.yml')
container.config.giphy.api_key.from_env('GIPHY_API_KEY')
app: web.Application = container.app()
app.container = container
app.add_routes([
web.get('/', container.index_view.as_view()),
])
return app