python-dependency-injector/examples/miniapps/sanic/giphynavigator/application.py
2021-10-27 20:58:24 -04:00

18 lines
398 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.giphy.api_key.from_env("GIPHY_API_KEY")
app = Sanic("giphy-navigator")
app.ctx.container = container
app.add_route(handlers.index, "/")
return app