diff --git a/README.md b/README.md index 486e579..01f2237 100644 --- a/README.md +++ b/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 diff --git a/backend/project.py b/backend/project.py index 7cd1e18..63b00df 100644 --- a/backend/project.py +++ b/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) diff --git a/frontend/package.json b/frontend/package.json index 71c30dc..be132df 100644 --- a/frontend/package.json +++ b/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", diff --git a/frontend/src/App.js b/frontend/src/App.js index b7d000b..72052df 100644 --- a/frontend/src/App.js +++ b/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));