用redis做缓存

This commit is contained in:
曹前明 2022-08-08 16:33:43 +08:00
parent 31d59ce470
commit c23dc2726c
1 changed files with 10 additions and 0 deletions

View File

@ -85,6 +85,16 @@ TEMPLATES = [
WSGI_APPLICATION = 'server.wsgi.application' WSGI_APPLICATION = 'server.wsgi.application'
CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://localhost:6379/1",
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
}
}
}
# Database # Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases # https://docs.djangoproject.com/en/3.0/ref/settings/#databases