From a407540106ab70f2c0ee0a207546314d85f8c6fc Mon Sep 17 00:00:00 2001 From: Sudan Bhandari Date: Fri, 30 Aug 2024 14:55:13 +0545 Subject: [PATCH] Fixes setting env files --- docker-compose.yml | 8 +++++--- gh-docker-compose.yml | 8 ++++---- main/settings.py | 13 ++++++++++--- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 261e93b..ea55a25 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,14 +14,15 @@ services: - redis-data:/data qdrant: - image: qdrant/qdrant:latest + image: qdrant/qdrant:v1.11.3 ports: - - "6333:6333" + - 127.0.0.1:6333:6333 volumes: - qdrant_data:/qdrant/storage restart: always environment: - QDRANT_HOST=0.0.0.0 + web: build: . env_file: @@ -39,7 +40,8 @@ services: volumes: - .:/code ports: - - "8100:8100" + - 127.0.0.1:8001:8001 + depends_on: - db - redis diff --git a/gh-docker-compose.yml b/gh-docker-compose.yml index cc4dd3f..8c99b06 100644 --- a/gh-docker-compose.yml +++ b/gh-docker-compose.yml @@ -1,12 +1,12 @@ services: db: - image: postgres:15-alpine + image: postgres:16-alpine environment: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: postgres volumes: - - postgres-data13:/var/lib/postgresql/data + - postgres-data16:/var/lib/postgresql/data redis: image: redis:6-alpine @@ -14,7 +14,7 @@ services: - redis-data:/data qdrant: - image: qdrant/qdrant:latest + image: qdrant/qdrant:v1.11.3 ports: - "6333:6333" volumes: @@ -61,6 +61,6 @@ services: - redis volumes: - postgres-data13: + postgres-data16: redis-data: qdrant_data: diff --git a/main/settings.py b/main/settings.py index 4038c95..c2ce338 100644 --- a/main/settings.py +++ b/main/settings.py @@ -10,6 +10,7 @@ https://docs.djangoproject.com/en/5.1/ref/settings/ """ +import os from pathlib import Path import environ @@ -21,6 +22,10 @@ DJANGO_DEBUG=(bool, False), DJANGO_SECRET_KEY=str, DJANGO_CORS_ORIGIN_REGEX_WHITELIST=(list, []), + DJANGO_ALLOWED_HOST=(list, ["*"]), + DJANGO_STATIC_ROOT=(str, os.path.join(BASE_DIR, "assets/static")), # Where to store + DJANGO_MEDIA_ROOT=(str, os.path.join(BASE_DIR, "assets/media")), # Where to store + DJANGO_TIME_ZONE=(str, "UTC"), # Database DATABASE_NAME=str, DATABASE_USER=str, @@ -43,9 +48,9 @@ SECRET_KEY = env("DJANGO_SECRET_KEY") # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True +DEBUG = env("DJANGO_DEBUG") -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = env("DJANGO_ALLOWED_HOST") # Application definition @@ -130,7 +135,7 @@ LANGUAGE_CODE = "en-us" -TIME_ZONE = "UTC" +TIME_ZONE = env("DJANGO_TIME_ZONE") USE_I18N = True @@ -141,6 +146,8 @@ # https://docs.djangoproject.com/en/5.1/howto/static-files/ STATIC_URL = "static/" +STATIC_ROOT = env("DJANGO_STATIC_ROOT") +MEDIA_ROOT = env("DJANGO_MEDIA_ROOT") # Default primary key field type # https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field