mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-29 13:04:02 +03:00
22 lines
484 B
Python
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
|