Fixing database error
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing

This commit is contained in:
cami 2021-07-14 00:46:51 +02:00
parent 46ce8655f3
commit 9aa573384b
4 changed files with 13 additions and 8 deletions

View file

@ -1,2 +1,2 @@
venv venv
src/database.py src/database.db

View file

@ -75,6 +75,11 @@ db.init_app(app)
# Initializes CORS so that the api_tool can talk to the example app # Initializes CORS so that the api_tool can talk to the example app
cors.init_app(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']) @app.route('/api/login', methods=['POST'])
def login(): def login():
@ -106,7 +111,6 @@ def refresh():
$ curl http://localhost:5000/api/refresh -X GET \ $ curl http://localhost:5000/api/refresh -X GET \
-H "Authorization: Bearer <your_token>" -H "Authorization: Bearer <your_token>"
""" """
print("refresh request")
old_token = request.get_data() old_token = request.get_data()
new_token = guard.refresh_jwt_token(old_token) new_token = guard.refresh_jwt_token(old_token)
ret = {'access_token': new_token} ret = {'access_token': new_token}
@ -215,7 +219,6 @@ def survey():
user_db.education = education user_db.education = education
user_db.skills = skills user_db.skills = skills
db.session.commit() db.session.commit()
print(req)
ret = {'message': 'Vielen Dank für das Ausfüllen der Umfrage.'} ret = {'message': 'Vielen Dank für das Ausfüllen der Umfrage.'}
return ret, 200 return ret, 200
else: else:

View file

@ -1,13 +1,13 @@
version: '3.7' version: '3.7'
services: services:
frontend_bt: frontend-prod:
image: caminsha/bt-frontend image: caminsha/bt-frontend
container_name: frontend-prod container_name: frontend-prod
ports: ports:
- 3000:3000 - 3000:80
backend-prod: backend-prod:
image: caminsha/bt-backend image: caminsha/bt-backend
container_name: frontend-prod container_name: backend-prod
environment: environment:
DEBUG: "no" DEBUG: "no"
PORT: 5000 PORT: 5000

View file

@ -1,4 +1,6 @@
podman stop frontend-{dev,prod} backend-{dev,prod} podman stop frontend-dev frontend-prod frontend-testing backend-dev backend-prod backend-testing
podman rmi caminsha/bt-{frontend,backend} 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 down
podman-compose -f docker-compose.prod.yml down podman-compose -f docker-compose.prod.yml down