From ceb49bc114937e146dc261db89815a988d61d588 Mon Sep 17 00:00:00 2001 From: Kumi Date: Thu, 19 Sep 2024 19:03:44 +0200 Subject: [PATCH] refactor: simplify app initialization by removing factory Streamlined the Flask app setup by eliminating the factory function and directly initializing the app and registering blueprints in the global scope. This reduces complexity and improves readability. No functional changes introduced. --- src/small/app.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/small/app.py b/src/small/app.py index e424dc0..8ddaab8 100644 --- a/src/small/app.py +++ b/src/small/app.py @@ -4,20 +4,15 @@ from os import environ from .views import home, article, error, proxy +app = Flask(__name__) -def create_app(): - app = Flask(__name__) - - app.register_blueprint(home.bp) - app.register_blueprint(article.bp) - app.register_blueprint(error.bp) - app.register_blueprint(proxy.bp) - - return app +app.register_blueprint(home.bp) +app.register_blueprint(article.bp) +app.register_blueprint(error.bp) +app.register_blueprint(proxy.bp) def main(): - app = create_app() port = int(environ.get("PORT", 8115)) app.run(port=port)