Browse Source

dunno

master
Marc 3 years ago
parent
commit
3b72afff08
4 changed files with 11 additions and 6 deletions
  1. 8
      README.md
  2. 2
      backend/project.py
  3. 3
      frontend/package.json
  4. 4
      frontend/src/App.js

8
README.md

@ -1,6 +1,8 @@
## Requirements
npm >= 6.0
in /frontend:
npm install, um die notwendigen node_modules zu installieren
pip:
* wheel
@ -18,11 +20,11 @@ After=network.target
[Service]
User=maintenance
Group=www-data
WorkingDirectory=/path/to/project
Environment="PATH=/path/to/project/bin"
WorkingDirectory=/path/to/project/backend
Environment="PATH=/path/to/project/venv/backend/bin"
#remove --reload when site is ready
#reload restarts workers when code changes
ExecStart=/path/to/project/bin/gunicorn --reload --workers 3 --bind 0.0.0.0:8900 wsgi:app
ExecStart=/path/to/project/backend/venv/bin/gunicorn --reload --workers 3 --bind 0.0.0.0:8900 wsgi:app
[Install]
WantedBy=multi-user.target

2
backend/project.py

@ -1,9 +1,11 @@
from flask import Flask, request, jsonify
from flask_sqlalchemy import SQLAlchemy
from flask_cors import CORS
import time
app = Flask(__name__)
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///primemeat.db"
CORS(app)
# DB
db = SQLAlchemy(app)

3
frontend/package.json

@ -12,7 +12,8 @@
"react-chartjs-2": "^2.10.0",
"react-dom": "^17.0.1",
"react-scripts": "4.0.0",
"web-vitals": "^0.2.4"
"web-vitals": "^0.2.4",
"yarn": "^1.22.10"
},
"scripts": {
"start": "PORT=4000 react-scripts start",

4
frontend/src/App.js

@ -32,7 +32,7 @@ function App() {
const [isLoaded, setIsLoaded] = useState(false);
useEffect(() => {
fetch('/api/umsatz')
fetch('http://127.0.0.1:8900/api/umsatz')
.then(response => response.json())
.then(data => {
setIsLoaded(true);
@ -42,7 +42,7 @@ function App() {
setIsLoaded(true);
setError(error);
});
fetch('/time')
fetch('http://127.0.0.1:8900/time')
.then(result => result.json())
.then(data => {
setCurrentTime(sec2time(data.time));

Loading…
Cancel
Save