Don't cache if DEBUG
This commit is contained in:
parent
32e9ccb413
commit
c5869024e0
1 changed files with 16 additions and 10 deletions
|
|
@ -173,13 +173,19 @@ SITE_ID = 1
|
||||||
REDIS_PASSWORD: str = os.getenv(key="REDIS_PASSWORD", default="")
|
REDIS_PASSWORD: str = os.getenv(key="REDIS_PASSWORD", default="")
|
||||||
REDIS_HOST: str = os.getenv(key="REDIS_HOST", default="192.168.1.2")
|
REDIS_HOST: str = os.getenv(key="REDIS_HOST", default="192.168.1.2")
|
||||||
REDIS_PORT: str = os.getenv(key="REDIS_PORT", default="6379")
|
REDIS_PORT: str = os.getenv(key="REDIS_PORT", default="6379")
|
||||||
CACHES: dict[str, dict[str, str]] = {
|
if not DEBUG:
|
||||||
|
CACHES: dict[str, dict[str, str]] = {
|
||||||
"default": {
|
"default": {
|
||||||
"BACKEND": "django.core.cache.backends.redis.RedisCache",
|
"BACKEND": "django.core.cache.backends.redis.RedisCache",
|
||||||
"LOCATION": f"redis://:{REDIS_PASSWORD}@{REDIS_HOST}:{REDIS_PORT}/0",
|
"LOCATION": f"redis://:{REDIS_PASSWORD}@{REDIS_HOST}:{REDIS_PORT}/0",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
CACHE_MIDDLEWARE_ALIAS = "default"
|
||||||
CACHE_MIDDLEWARE_ALIAS = "default"
|
CACHE_MIDDLEWARE_SECONDS = 600 # 10 minutes
|
||||||
CACHE_MIDDLEWARE_SECONDS = 600 # 10 minutes
|
CACHE_MIDDLEWARE_KEY_PREFIX = "feedvault"
|
||||||
CACHE_MIDDLEWARE_KEY_PREFIX = "feedvault"
|
else:
|
||||||
|
CACHES: dict[str, dict[str, str]] = {
|
||||||
|
"default": {
|
||||||
|
"BACKEND": "django.core.cache.backends.dummy.DummyCache",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue