2024-04-15 04:02:47 +03:00
|
|
|
from dishka.integrations.flask import setup_dishka
|
2024-04-13 04:41:30 +03:00
|
|
|
from flask import Flask
|
2024-04-15 04:02:47 +03:00
|
|
|
from ioc import create_container
|
2024-04-15 02:16:07 +03:00
|
|
|
from routers.key import key_bp
|
2024-04-13 04:41:30 +03:00
|
|
|
|
|
|
|
|
|
|
|
def app_factory() -> Flask:
|
|
|
|
app = Flask(__name__)
|
2024-04-15 02:16:07 +03:00
|
|
|
app.register_blueprint(key_bp)
|
2024-04-13 04:41:30 +03:00
|
|
|
return app
|
2024-04-15 02:16:07 +03:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
app = app_factory()
|
2024-04-15 04:02:47 +03:00
|
|
|
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()
|