Skip to content
Closed
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
6 changes: 3 additions & 3 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -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
23 changes: 12 additions & 11 deletions azureproject/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand All @@ -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",
},
}
}
# 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",
# },
# }
# }
23 changes: 12 additions & 11 deletions azureproject/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 = [
Expand Down Expand Up @@ -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/
Expand Down
Loading