Skip to content
Merged

fix #40

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
LOGISTICS_SERVICE_PORT=8002
DJANGO_PORT=8000
LOGISTICS_SERVICE_PORT=8002
KAFKA_BROKER_URL=kafka:9092
IS_DOCKER=False
IS_DOCKER=True
ALLOWED_HOSTS=localhost,logistics_service,api_gateway
8 changes: 5 additions & 3 deletions logistics_core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"""

from pathlib import Path
import os

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
Expand All @@ -23,9 +24,9 @@
SECRET_KEY = 'django-insecure-5@qk89oz+(pmq*d$+k-#lb(*z(rf35m0y2+4=msy@2hc1*-_v)'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
DEBUG = False

ALLOWED_HOSTS = []
ALLOWED_HOSTS = os.getenv('ALLOWED_HOSTS', '').split(',')

Copilot AI May 10, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When ALLOWED_HOSTS is not set, this will result in a list containing an empty string. Consider filtering out empty elements or providing a fallback to avoid potential misconfigurations.

Suggested change
ALLOWED_HOSTS = os.getenv('ALLOWED_HOSTS', '').split(',')
ALLOWED_HOSTS = [host for host in os.getenv('ALLOWED_HOSTS', '').split(',') if host.strip()]
if not ALLOWED_HOSTS:
ALLOWED_HOSTS = [] # Explicitly disallow all hosts if not set

Copilot uses AI. Check for mistakes.


# Application definition
Expand Down Expand Up @@ -125,7 +126,8 @@
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.2/howto/static-files/

STATIC_URL = 'static/'
STATIC_URL = '/static/'
STATIC_ROOT = BASE_DIR / 'staticfiles'

# Default primary key field type
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
Expand Down