From 9aa573384b91f902b4e3d1f9a8ff053c7bd2119e Mon Sep 17 00:00:00 2001 From: cami Date: Wed, 14 Jul 2021 00:46:51 +0200 Subject: [PATCH] Fixing database error --- backend/.dockerignore | 2 +- backend/src/app.py | 7 +++++-- docker-compose.prod.yml | 6 +++--- stop.sh | 6 ++++-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/backend/.dockerignore b/backend/.dockerignore index 75d27c5..647b70a 100644 --- a/backend/.dockerignore +++ b/backend/.dockerignore @@ -1,2 +1,2 @@ venv -src/database.py +src/database.db diff --git a/backend/src/app.py b/backend/src/app.py index 50f1cf5..9c085b3 100644 --- a/backend/src/app.py +++ b/backend/src/app.py @@ -75,6 +75,11 @@ db.init_app(app) # Initializes CORS so that the api_tool can talk to the example app cors.init_app(app) +# create database +# Add users for the example +with app.app_context(): + db.create_all() + db.session.commit() @app.route('/api/login', methods=['POST']) def login(): @@ -106,7 +111,6 @@ def refresh(): $ curl http://localhost:5000/api/refresh -X GET \ -H "Authorization: Bearer " """ - print("refresh request") old_token = request.get_data() new_token = guard.refresh_jwt_token(old_token) ret = {'access_token': new_token} @@ -215,7 +219,6 @@ def survey(): user_db.education = education user_db.skills = skills db.session.commit() - print(req) ret = {'message': 'Vielen Dank für das Ausfüllen der Umfrage.'} return ret, 200 else: diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index fd9d504..0d9dba1 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -1,13 +1,13 @@ version: '3.7' services: - frontend_bt: + frontend-prod: image: caminsha/bt-frontend container_name: frontend-prod ports: - - 3000:3000 + - 3000:80 backend-prod: image: caminsha/bt-backend - container_name: frontend-prod + container_name: backend-prod environment: DEBUG: "no" PORT: 5000 diff --git a/stop.sh b/stop.sh index 3f622cf..786eb3b 100644 --- a/stop.sh +++ b/stop.sh @@ -1,4 +1,6 @@ -podman stop frontend-{dev,prod} backend-{dev,prod} -podman rmi caminsha/bt-{frontend,backend} +podman stop frontend-dev frontend-prod frontend-testing backend-dev backend-prod backend-testing +podman rm frontend-dev frontend-prod frontend-testing backend-dev backend-prod backend-testing +podman rmi {frontend,backend}-testing +podman rmi caminsha/bt-frontend caminsha/bt-backend podman-compose down podman-compose -f docker-compose.prod.yml down