From 9156793852f4d6c8af3c77ffe069a7c4457353db Mon Sep 17 00:00:00 2001 From: Thomas Rubini <74205383+ThomasRubini@users.noreply.github.com> Date: Tue, 3 Jan 2023 16:59:42 +0100 Subject: [PATCH] refactor 'app' to 'APP' --- app.py | 2 +- tests/test_api.py | 4 ++-- truthseeker/__init__.py | 8 +++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app.py b/app.py index 85345e1..0a00714 100644 --- a/app.py +++ b/app.py @@ -1,4 +1,4 @@ -from truthseeker import app # the variable 'app' is detected by `flask run` +from truthseeker import APP as app # the variable 'app' is detected by `flask run` if __name__ == "__main__": app.run() diff --git a/tests/test_api.py b/tests/test_api.py index 4235864..f4924ae 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -1,8 +1,8 @@ import json import pytest -from truthseeker import app +from truthseeker import APP -test_app = app.test_client() +test_app = APP.test_client() class TestException(Exception): __test__ = False diff --git a/truthseeker/__init__.py b/truthseeker/__init__.py index 2036856..6229d31 100644 --- a/truthseeker/__init__.py +++ b/truthseeker/__init__.py @@ -29,7 +29,9 @@ class TruthSeekerApp(flask.Flask): f.close() print("Generated secret and wrote to secret.txt !") -app = TruthSeekerApp() +APP = TruthSeekerApp() -app.register_blueprint(routes_api.routes_api, url_prefix="/api/v1") -app.register_blueprint(routes_ui.routes_ui, url_prefix="/") +from truthseeker.routes import routes_api, routes_ui + +APP.register_blueprint(routes_api.routes_api, url_prefix="/api/v1") +APP.register_blueprint(routes_ui.routes_ui, url_prefix="/")