python-dependency-injector/examples/miniapps/ghnav-flask/githubnavigator/containers.py
Roman Mogylatov 6eff213a68
Migrate to alabaster (#264)
* Add bootstrap and remove created at from ghnav-flask app

* Update readme

* Add logo to the docs

* Update key features description

* Update README

* Change headers of API docs

* Add alabaster theme config

* Update docs index

* Add tutorials section

* Update what is DI page

* Update DI in Python page

* Update tutorials index page

* Update provider docs

* Update container docs

* Update examples docs
2020-07-18 00:40:14 -04:00

38 lines
963 B
Python

"""Application containers module."""
from dependency_injector import containers, providers
from dependency_injector.ext import flask
from flask import Flask
from flask_bootstrap import Bootstrap
from github import Github
from . import views, services
class ApplicationContainer(containers.DeclarativeContainer):
"""Application container."""
app = flask.Application(Flask, __name__)
bootstrap = flask.Extension(Bootstrap)
config = providers.Configuration()
github_client = providers.Factory(
Github,
login_or_token=config.github.auth_token,
timeout=config.github.request_timeout,
)
search_service = providers.Factory(
services.SearchService,
github_client=github_client,
)
index_view = flask.View(
views.index,
search_service=search_service,
default_search_term=config.search.default_term,
default_search_limit=config.search.default_limit,
)