mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-06-30 02:13:27 +03:00
Change code layout in miniapps
This commit is contained in:
parent
2669e4d27b
commit
67b8e122bf
|
@ -6,7 +6,7 @@ from .containers import Container
|
|||
from . import handlers
|
||||
|
||||
|
||||
def create_app():
|
||||
def create_app() -> web.Application:
|
||||
"""Create and return aiohttp application."""
|
||||
container = Container()
|
||||
container.config.from_yaml('config.yml')
|
||||
|
@ -15,9 +15,7 @@ def create_app():
|
|||
|
||||
app = web.Application()
|
||||
app.container = container
|
||||
|
||||
app.add_routes([
|
||||
web.get('/', handlers.index),
|
||||
])
|
||||
|
||||
return app
|
||||
|
|
|
@ -7,7 +7,7 @@ from .containers import Container
|
|||
from . import views
|
||||
|
||||
|
||||
def create_app():
|
||||
def create_app() -> Flask:
|
||||
container = Container()
|
||||
container.config.from_yaml('config.yml')
|
||||
container.config.github.auth_token.from_env('GITHUB_TOKEN')
|
||||
|
@ -15,10 +15,9 @@ def create_app():
|
|||
|
||||
app = Flask(__name__)
|
||||
app.container = container
|
||||
app.add_url_rule('/', 'index', views.index)
|
||||
|
||||
bootstrap = Bootstrap()
|
||||
bootstrap.init_app(app)
|
||||
|
||||
app.add_url_rule('/', 'index', views.index)
|
||||
|
||||
return app
|
||||
|
|
|
@ -6,7 +6,7 @@ from .containers import Container
|
|||
from . import handlers
|
||||
|
||||
|
||||
def create_app():
|
||||
def create_app() -> Sanic:
|
||||
"""Create and return aiohttp application."""
|
||||
container = Container()
|
||||
container.config.from_yaml('config.yml')
|
||||
|
@ -15,7 +15,5 @@ def create_app():
|
|||
|
||||
app = Sanic('Giphy Navigator')
|
||||
app.container = container
|
||||
|
||||
app.add_route(handlers.index, '/')
|
||||
|
||||
return app
|
||||
|
|
Loading…
Reference in New Issue
Block a user