From 803f8816de892384a96b4d12988b2b12e1023f9d Mon Sep 17 00:00:00 2001 From: Mangesh Sangapu Date: Thu, 16 Jul 2026 11:14:33 -0500 Subject: [PATCH] Disable Redis code paths and comment Redis-related config for local/runtime settings --- .devcontainer/docker-compose.yml | 6 +++--- .env | 2 +- azureproject/production.py | 23 ++++++++++++----------- azureproject/settings.py | 23 ++++++++++++----------- 4 files changed, 28 insertions(+), 26 deletions(-) diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 21855366..033e1d26 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -28,9 +28,9 @@ services: # Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally. # (Adding the "ports" property to this file will not forward from a Codespace.) - redis: - image: redis - restart: unless-stopped + # redis: + # image: redis + # restart: unless-stopped volumes: postgres-data: diff --git a/.env b/.env index 7e893174..02095cf8 100644 --- a/.env +++ b/.env @@ -2,5 +2,5 @@ DBNAME=app DBHOST=localhost DBUSER=app_user DBPASS=app_password -CACHELOCATION=redis://redis:6379/0 +# CACHELOCATION=redis://redis:6379/0 SECRET_KEY=secret_key diff --git a/azureproject/production.py b/azureproject/production.py index 76b6e1f0..a7ea06a3 100644 --- a/azureproject/production.py +++ b/azureproject/production.py @@ -22,7 +22,8 @@ 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] -SESSION_ENGINE = "django.contrib.sessions.backends.cache" +# SESSION_ENGINE = "django.contrib.sessions.backends.cache" +SESSION_ENGINE = "django.contrib.sessions.backends.db" STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') @@ -36,13 +37,13 @@ } } -CACHES = { - "default": { - "BACKEND": "django_redis.cache.RedisCache", - "LOCATION": os.environ['AZURE_REDIS_CONNECTIONSTRING'], - "OPTIONS": { - "CLIENT_CLASS": "django_redis.client.DefaultClient", - "COMPRESSOR": "django_redis.compressors.zlib.ZlibCompressor", - }, - } -} \ No newline at end of file +# CACHES = { +# "default": { +# "BACKEND": "django_redis.cache.RedisCache", +# "LOCATION": os.environ['AZURE_REDIS_CONNECTIONSTRING'], +# "OPTIONS": { +# "CLIENT_CLASS": "django_redis.client.DefaultClient", +# "COMPRESSOR": "django_redis.compressors.zlib.ZlibCompressor", +# }, +# } +# } diff --git a/azureproject/settings.py b/azureproject/settings.py index 5d890707..e89bb205 100644 --- a/azureproject/settings.py +++ b/azureproject/settings.py @@ -29,7 +29,7 @@ ALLOWED_HOSTS = [] if 'CODESPACE_NAME' in os.environ: - CSRF_TRUSTED_ORIGINS = [f'https://{os.getenv("CODESPACE_NAME")}-8000.{os.getenv("GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN")}'] + CSRF_TRUSTED_ORIGINS = [f'https://{os.getenv("CODESPACE_NAME")}-8000.{os.getenv("GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN") }'] # Application definition @@ -53,7 +53,8 @@ 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] -SESSION_ENGINE = "django.contrib.sessions.backends.cache" +# SESSION_ENGINE = "django.contrib.sessions.backends.cache" +SESSION_ENGINE = "django.contrib.sessions.backends.db" ROOT_URLCONF = 'azureproject.urls' TEMPLATES = [ @@ -120,15 +121,15 @@ }, ] -CACHES = { - "default": { - "BACKEND": "django_redis.cache.RedisCache", - "LOCATION": os.environ.get('CACHELOCATION'), - "OPTIONS": { - "CLIENT_CLASS": "django_redis.client.DefaultClient", - }, - } -} +# CACHES = { +# "default": { +# "BACKEND": "django_redis.cache.RedisCache", +# "LOCATION": os.environ.get('CACHELOCATION'), +# "OPTIONS": { +# "CLIENT_CLASS": "django_redis.client.DefaultClient", +# }, +# } +# } # Internationalization # https://docs.djangoproject.com/en/4.0/topics/i18n/