added start.sh
This commit is contained in:
parent
a03e06a6de
commit
b6b6621a95
5 changed files with 39 additions and 4 deletions
|
|
@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/5.1/ref/settings/
|
|||
"""
|
||||
|
||||
from pathlib import Path
|
||||
import os
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
|
@ -50,16 +51,20 @@ MIDDLEWARE = [
|
|||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
'corsheaders.middleware.CorsMiddleware',
|
||||
'whitenoise.middleware.WhiteNoiseMiddleware',
|
||||
]
|
||||
|
||||
MIDDLEWARE.insert(0, 'corsheaders.middleware.CorsMiddleware')
|
||||
|
||||
CORS_ALLOWED_ORIGINS = [
|
||||
"http://localhost:3000",
|
||||
"volucy-gateway-e3d2bzbxdeaaayhz.westeurope-01.azurewebsites.net",
|
||||
]
|
||||
|
||||
CORS_ALLOW_CREDENTIALS = True
|
||||
|
||||
STATIC_URL = "/static/"
|
||||
STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
|
||||
|
||||
ROOT_URLCONF = 'backend.urls'
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
REACT_APP_API_URL=http://localhost:8000
|
||||
REACT_APP_API_URL=https://volucy-gateway-e3d2bzbxdeaaayhz.westeurope-01.azurewebsites.net
|
||||
|
|
|
|||
6
frontend/frontend/src/api.js
Normal file
6
frontend/frontend/src/api.js
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
const API_URL = process.env.REACT_APP_API_URL;
|
||||
|
||||
export const fetchData = async () => {
|
||||
const response = await fetch(`${API_URL}/data/`);
|
||||
return response.json();
|
||||
};
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
Flask
|
||||
requests
|
||||
Django
|
||||
gunicorn
|
||||
django-cors-headers
|
||||
whitenoise
|
||||
openai
|
||||
|
|
|
|||
22
start.sh
Normal file
22
start.sh
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
# Installiere Abhängigkeiten
|
||||
cd backend
|
||||
python -m venv venv
|
||||
source venv/bin/activate
|
||||
pip install -r requirements.txt
|
||||
|
||||
# Migration durchführen
|
||||
python manage.py migrate
|
||||
python manage.py collectstatic --noinput
|
||||
|
||||
# React bauen
|
||||
cd ../frontend
|
||||
npm install
|
||||
npm run build
|
||||
|
||||
# React-Frontend nach Django-Statisches-Verzeichnis verschieben
|
||||
cp -r build/* ../backend/staticfiles/
|
||||
|
||||
# Starte Gunicorn (Django-Server)
|
||||
cd ../backend
|
||||
gunicorn backend.wsgi --bind 0.0.0.0:$PORT
|
||||
Loading…
Reference in a new issue