From 06a53a744260c0bce89b955e06295940934e7353 Mon Sep 17 00:00:00 2001 From: JulienChampagnol Date: Fri, 21 Jun 2024 14:10:26 +0200 Subject: [PATCH 1/4] fix(relative import): bug in prod --- src/geodeapp_back/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/geodeapp_back/app.py b/src/geodeapp_back/app.py index 5b3fad2..59197d9 100644 --- a/src/geodeapp_back/app.py +++ b/src/geodeapp_back/app.py @@ -15,7 +15,7 @@ from werkzeug.exceptions import HTTPException -from .config import * +from geodeapp_back.config import * from opengeodeweb_back.geode_functions import handle_exception From 79f17084db965aeb2360fbc6bf10edefaa86bc1a Mon Sep 17 00:00:00 2001 From: JulienChampagnol Date: Fri, 21 Jun 2024 16:43:39 +0200 Subject: [PATCH 2/4] fix(relative import): fix all import bugs --- __init__.py | 0 src/geodeapp_back/__init__.py | 1 - src/geodeapp_back/app.py | 20 ++++++++------------ 3 files changed, 8 insertions(+), 13 deletions(-) delete mode 100644 __init__.py diff --git a/__init__.py b/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/geodeapp_back/__init__.py b/src/geodeapp_back/__init__.py index 27c9ec6..e69de29 100644 --- a/src/geodeapp_back/__init__.py +++ b/src/geodeapp_back/__init__.py @@ -1 +0,0 @@ -from .config import * diff --git a/src/geodeapp_back/app.py b/src/geodeapp_back/app.py index 59197d9..8c47507 100644 --- a/src/geodeapp_back/app.py +++ b/src/geodeapp_back/app.py @@ -1,22 +1,18 @@ -""" Packages """ - +# Global packages import os import dotenv +import time +# Third parties import flask import flask_cors -import time - - from opengeodeweb_back import geode_functions from opengeodeweb_back.routes import blueprint_routes - from werkzeug.exceptions import HTTPException - from werkzeug.exceptions import HTTPException -from geodeapp_back.config import * -from opengeodeweb_back.geode_functions import handle_exception +# Local libraries +from geodeapp_back import config if os.path.isfile("./.env"): @@ -61,9 +57,9 @@ def kill_task(): if FLASK_DEBUG == False: - app.config.from_object(ProdConfig) + app.config.from_object(config.ProdConfig) else: - app.config.from_object(DevConfig) + app.config.from_object(config.DevConfig) ID = app.config.get("ID") PORT = int(app.config.get("PORT")) @@ -88,7 +84,7 @@ def kill_task(): @app.errorhandler(HTTPException) def errorhandler(e): - return handle_exception(e) + return geode_functions.handle_exception(e) @app.route("/", methods=["POST"]) def root(): From c5a80931c431074f184a04355f5669f340a7d410 Mon Sep 17 00:00:00 2001 From: JulienChampagnol Date: Fri, 21 Jun 2024 16:55:01 +0200 Subject: [PATCH 3/4] fix(relative import): test with python 3.10 --- .github/workflows/CICD.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 7abe250..94e84d8 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -10,7 +10,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: "3.9" + python-version: "3.10" - name: Test run: | pip install -r requirements.txt From 5390d0212722fe52cca1d49636ad8fe7f274fea4 Mon Sep 17 00:00:00 2001 From: JulienChampagnol Date: Fri, 21 Jun 2024 17:28:19 +0200 Subject: [PATCH 4/4] fix(CICD): pip install . --- .github/workflows/CICD.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 94e84d8..dc5f38e 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -14,6 +14,7 @@ jobs: - name: Test run: | pip install -r requirements.txt + pip install . pip install pytest pytest build: