flask-webhook/flask_demo_api/main.py

27 lines
608 B
Python
Raw Permalink Normal View History

2024-04-22 04:00:23 +03:00
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.webhook import wh_bp
def app_factory() -> Flask:
app = Flask(__name__)
register_errors(app)
app.register_blueprint(wh_bp)
return app
def run_app():
app = app_factory()
container = create_container()
setup_dishka(container=container, app=app, auto_inject=True)
app.run(host="0.0.0.0", debug=True)
container.close()
if __name__ == "__main__":
run_app()