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.
This commit is contained in:
Kumi 2024-09-19 19:03:44 +02:00
parent 7d208780aa
commit ceb49bc114
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -4,20 +4,15 @@ from os import environ
from .views import home, article, error, proxy from .views import home, article, error, proxy
app = Flask(__name__)
def create_app(): app.register_blueprint(home.bp)
app = Flask(__name__) app.register_blueprint(article.bp)
app.register_blueprint(error.bp)
app.register_blueprint(home.bp) app.register_blueprint(proxy.bp)
app.register_blueprint(article.bp)
app.register_blueprint(error.bp)
app.register_blueprint(proxy.bp)
return app
def main(): def main():
app = create_app()
port = int(environ.get("PORT", 8115)) port = int(environ.get("PORT", 8115))
app.run(port=port) app.run(port=port)