From 02fc2bb4ef3ac0487ddc845000e0a6fb73b097f2 Mon Sep 17 00:00:00 2001 From: cami Date: Tue, 22 Jun 2021 02:15:40 +0200 Subject: [PATCH] Started debugging backend stuff.. --- backend/Dockerfile | 2 +- backend/requirements.txt | 15 +++++++++++++++ backend/src/app.py | 13 +++++++++++++ docker-compose.yml | 2 +- frontend/src/components/pages/Manual.js | 12 ++++++++++-- 5 files changed, 40 insertions(+), 4 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 10162a5..8eb7a25 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,6 +1,6 @@ FROM python -WORKDIR /opt/ +WORKDIR /app COPY requirements.txt . diff --git a/backend/requirements.txt b/backend/requirements.txt index 336fcb4..75a45e2 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -1,11 +1,26 @@ +blinker==1.4 click==7.1.2 +Deprecated==1.2.12 Flask==1.1.2 +flask-buzz==0.1.15 +Flask-Cors==3.0.10 Flask-Login==0.5.0 +Flask-Mail==0.9.1 +flask-praetorian==1.2.0 Flask-SQLAlchemy==2.5.1 greenlet==1.1.0 +inflection==0.3.1 itsdangerous==1.1.0 Jinja2==2.11.3 MarkupSafe==1.1.1 +passlib==1.7.4 +pendulum==2.1.2 +py-buzz==1.0.3 +PyJWT==2.1.0 +python-dateutil==2.8.1 python-dotenv==0.17.1 +pytzdata==2020.1 +six==1.16.0 SQLAlchemy==1.4.15 Werkzeug==1.0.1 +wrapt==1.12.1 diff --git a/backend/src/app.py b/backend/src/app.py index 66747a3..eb6b282 100644 --- a/backend/src/app.py +++ b/backend/src/app.py @@ -1,5 +1,8 @@ import time from flask import Flask +import flask_sqlalchemy +import flask_praetorian +import flask_cors import os @@ -20,6 +23,16 @@ else: port = 5000 +db = flask_sqlalchemy.SQLAlchemy() +guard = flask_praetorian.Praetorian() +cors = flask_cors.CORS() + +class User(db.model): + id = db.Column(db.Integer, primary_key=True) + username = db.Column(db.Text, unique=True) + password = db.Column(db.Text) + + @app.route('/') def home(): diff --git a/docker-compose.yml b/docker-compose.yml index 2d3f675..6287abc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,7 +20,7 @@ services: dockerfile: Dockerfile tty: true volumes: - - ./backend:/usr/src/app/ + - ./backend:/app ports: - 5000:5000 environment: diff --git a/frontend/src/components/pages/Manual.js b/frontend/src/components/pages/Manual.js index f35e5fd..ea88d83 100644 --- a/frontend/src/components/pages/Manual.js +++ b/frontend/src/components/pages/Manual.js @@ -1,11 +1,19 @@ -import React from "react"; +import React, {useState, useEffect} from "react"; import "../../App.css"; import Footer from "../../Footer"; export default function Manual() { + const [currentTime, setCurrentTime] = useState(0); + + useEffect(() => { + fetch('/time').then(res => res.json()).then(data => { + setCurrentTime(data.time); + }); + }, []); + return ( <> -

Anleitung / Bedienungshinweise

+

Anleitung / Bedienungshinweise {currentTime}