From 3268e5364231f0239528919c9673d70551d1e809 Mon Sep 17 00:00:00 2001 From: Bleese B Date: Sun, 12 Jul 2026 03:55:26 +0200 Subject: [PATCH] WIP: local production settings updates --- backend/core/settings/base.py | 4 ++-- backend/core/settings/production.py | 8 ++++++-- backend/entrypoint.sh | 0 docker-compose.dev.yml | 11 ++++++++--- frontend/astro.config.mjs | 4 ++-- 5 files changed, 18 insertions(+), 9 deletions(-) mode change 100644 => 100755 backend/entrypoint.sh diff --git a/backend/core/settings/base.py b/backend/core/settings/base.py index 6525f07..fdfbd19 100644 --- a/backend/core/settings/base.py +++ b/backend/core/settings/base.py @@ -165,7 +165,7 @@ CELERY_TASK_SERIALIZER = 'json' STATIC_URL = '/static/' # Direktorij gdje će 'collectstatic' skupljati sve statičke datoteke (za produkciju) -STATIC_ROOT = BASE_DIR / '/app/staticfiles' +# STATIC_ROOT = BASE_DIR / '/app/staticfiles' # (Opcionalno, ali preporučeno za ERP) Ako koristiš i medije (dokumente) MEDIA_URL = '/media/' @@ -211,4 +211,4 @@ CACHES = { 'BACKEND': 'django.core.cache.backends.redis.RedisCache', 'LOCATION': 'redis://127.0.0.1:6379/1', } -} \ No newline at end of file +} diff --git a/backend/core/settings/production.py b/backend/core/settings/production.py index 525f8b5..ac9cddf 100644 --- a/backend/core/settings/production.py +++ b/backend/core/settings/production.py @@ -16,9 +16,11 @@ DATABASES = { } # Sigurnosne postavke -SECURE_SSL_REDIRECT = True SESSION_COOKIE_SECURE = True CSRF_COOKIE_SECURE = True +SECURE_SSL_REDIRECT = True +SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') +USE_X_FORWARDED_HOST = True # Produkcijski CORS (samo domena na kojoj vrti Astro) CORS_ALLOWED_ORIGINS = os.environ.get('CORS_ALLOWED_ORIGINS', '').split(',') @@ -34,5 +36,7 @@ CSRF_TRUSTED_ORIGINS = [ ] # Statika i Mediji +STATIC_URL = '/static/' STATIC_ROOT = '/app/staticfiles' -MEDIA_ROOT = '/app/media' \ No newline at end of file +MEDIA_URL = '/media/' +MEDIA_ROOT = '/app/media' diff --git a/backend/entrypoint.sh b/backend/entrypoint.sh old mode 100644 new mode 100755 diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 9060865..06bac2c 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -5,7 +5,7 @@ services: context: ./backend dockerfile: Dockerfile command: python manage.py runserver 0.0.0.0:8000 - user: "1000:1000" + user: "1001:1001" volumes: - ./backend:/app - media_volume:/app/media @@ -29,12 +29,17 @@ services: - ./frontend:/app - /app/node_modules environment: - - PUBLIC_API_URL=${PUBLIC_API_URL} - NODE_ENV=development - PUBLIC_ALLOWED_HOSTS=serviseri-004.captain.mitteworkspace.cloud - PUBLIC_HMR_HOST=serviseri-004.captain.mitteworkspace.cloud +<<<<<<< HEAD - PUBLIC_HMR_PROTOCOL=ws - PUBLIC_HMR_CLIENT_PORT=4321 +======= + - PUBLIC_HMR_PROTOCOL=wss + - PUBLIC_HMR_CLIENT_PORT=443 + - PUBLIC_API_URL=https://api-004.captain.mitteworkspace.cloud/api/ +>>>>>>> ea28748 (WIP: local production settings updates) flower: container_name: 004erpflower @@ -52,4 +57,4 @@ services: volumes: media_volume: - external: true # Ako je definiran u glavnom file-u, ovo ga povezuje \ No newline at end of file + external: true # Ako je definiran u glavnom file-u, ovo ga povezuje diff --git a/frontend/astro.config.mjs b/frontend/astro.config.mjs index 316ac7f..e83749a 100644 --- a/frontend/astro.config.mjs +++ b/frontend/astro.config.mjs @@ -13,7 +13,7 @@ const envHosts = (process.env.PUBLIC_ALLOWED_HOSTS || '') .filter(Boolean); const allowedHosts = Array.from( - new Set(['localhost', '127.0.0.1', ...envHosts]) + new Set(['localhost', '127.0.0.1', 'serviseri-004.captain.mitteworkspace.cloud', ...envHosts]) ); const hmrHost = process.env.PUBLIC_HMR_HOST || 'localhost'; @@ -70,4 +70,4 @@ export default defineConfig({ }, integrations: [preact()], -}); \ No newline at end of file +});