This commit is contained in:
Louis Mazin 2026-09-15 00:35:38 +02:00
parent 5fb1d2ddbd
commit 69da08d133
4 changed files with 16 additions and 7 deletions

View File

@ -83,7 +83,7 @@ WSGI_APPLICATION = 'core.wsgi.application'
DATABASES = {
'default': dj_database_url.config(
default=f"mysql://{config('DB_USER', default='user')}:{config('DB_PASSWORD', default='password')}@{config('DB_HOST', default='host')}:{config('DB_PORT', default='3306')}/{config('DB_NAME', default='name')}"
default=f"mysql://{config('MYSQL_USER', default='user')}:{config('MYSQL_PASSWORD', default='password')}@{config('MYSQL_HOST', default='host')}:{config('MYSQL_PORT', default='3306')}/{config('MYSQL_DATABASE', default='name')}"
)
}
@ -125,8 +125,8 @@ STATIC_URL = 'static/'
# CORS configuration
CORS_ALLOWED_ORIGINS = [
"http://localhost:5173",
"http://127.0.0.1:5173",
"http://localhost:1028",
"http://127.0.0.1:1028"
]
# REST Framework & JWT settings

View File

@ -2,7 +2,7 @@ import axios from 'axios';
// Utiliser l'URL correcte pour le backend
const api = axios.create({
baseURL: '/api',
baseURL: import.meta.env.PROD ? '/api' : 'http://localhost:1029/api',
});
// Ajouter un intercepteur pour gérer les erreurs de réseau

View File

@ -4,6 +4,17 @@ import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [react()],
server: {
proxy: {
'/api': {
target: 'http://localhost:1029',
changeOrigin: true,
secure: false,
rewrite: (path) => path.replace(/^\/api/, '/api')
}
}
},
preview: {
allowedHosts: [
'boulangerie.louismazin.ovh'

View File

@ -54,15 +54,13 @@ if [ ! -x "node_modules/.bin/vite" ]; then
npm ci
fi
export VITE_API_URL="/api"
echo "Build React..."
npm run build
echo "Démarrage frontend sur :1028"
npm run preview -- --host 0.0.0.0 --port 1028 &
npm run preview --host 0.0.0.0 --port 1028 &
FRONTEND_PID=$!
# --------------------------------------