python-dependency-injector/examples/miniapps/giphynav-aiohttp/giphynavigator/application.py

22 lines
484 B
Python
Raw Normal View History

"""Application module."""
from aiohttp import web
from .containers import ApplicationContainer
def create_app():
2020-07-30 20:52:42 +03:00
"""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