flask-demo-api/flask_demo_api/main.py

21 lines
490 B
Python

from dishka.integrations.flask import setup_dishka
from flask import Flask
from ioc import create_container
from routers.key import key_bp
def app_factory() -> Flask:
app = Flask(__name__)
app.register_blueprint(key_bp)
return app
if __name__ == "__main__":
app = app_factory()
container = create_container()
setup_dishka(container=container, app=app, auto_inject=True)
try:
app.run(debug=True, host="0.0.0.0")
finally:
container.close()