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:
parent
7d208780aa
commit
ceb49bc114
1 changed files with 5 additions and 10 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue