Skip to content
Snippets Groups Projects
Verified Commit 9210c012 authored by Antoine R. Dumont's avatar Antoine R. Dumont
Browse files

django 4 support: Adapt production settings for memcached changes

This adapts the memcached import the same way the swh.web module did.

Follow up on 4698e8c9

Refs. swh/infra/sysadm-environment#5129
parent 59a377cd
No related branches found
Tags v1.3.2
1 merge request!417django 4 support: Adapt production settings for memcached changes
Pipeline #5004 passed
# Copyright (C) 2017-2021 The Software Heritage developers
# Copyright (C) 2017-2023 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
import os
import django
from swh.core import config
from .common import * # noqa
......@@ -100,10 +102,13 @@ if authentication == "keycloak":
# Optional cache server
server_cache = conf.get("cache_uri")
if server_cache:
cache_backend = "django.core.cache.backends.memcached.MemcachedCache"
if django.VERSION[:2] >= (3, 2):
cache_backend = "django.core.cache.backends.memcached.PyMemcacheCache"
CACHES.update(
{
"default": {
"BACKEND": "django.core.cache.backends.memcached.MemcachedCache",
"BACKEND": cache_backend,
"LOCATION": server_cache,
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment