27 lines
580 B
Python
27 lines
580 B
Python
from dishka.integrations.flask import setup_dishka
|
|
from flask import Flask
|
|
|
|
from flask_demo_api.error_handlers import register_errors
|
|
from flask_demo_api.ioc import create_container
|
|
from flask_demo_api.routers.key import key_bp
|
|
|
|
|
|
def app_factory() -> Flask:
|
|
app = Flask(__name__)
|
|
register_errors(app)
|
|
app.register_blueprint(key_bp)
|
|
return app
|
|
|
|
|
|
def run_app():
|
|
app = app_factory()
|
|
|
|
container = create_container()
|
|
setup_dishka(container=container, app=app, auto_inject=True)
|
|
app.run()
|
|
container.close()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
run_app()
|