mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-30 13:33:59 +03:00
20 lines
478 B
Python
20 lines
478 B
Python
|
"""Application module."""
|
||
|
|
||
|
from sanic import Sanic
|
||
|
|
||
|
from .containers import Container
|
||
|
from . import handlers
|
||
|
|
||
|
|
||
|
def create_app() -> Sanic:
|
||
|
"""Create and return Sanic 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
|