mirror of
https://github.com/Alexander-D-Karpov/akarpov
synced 2024-11-22 06:16:34 +03:00
fixed cache
This commit is contained in:
parent
bb61d144c5
commit
b93b29d06c
|
@ -54,17 +54,17 @@
|
|||
|
||||
# CACHES
|
||||
# ------------------------------------------------------------------------------
|
||||
CACHE_TTL = 60 * 1500
|
||||
|
||||
CACHES = {"default": env.cache("REDIS_CACHE")}
|
||||
CACHES = {"default": env.cache_url("REDIS_CACHE")}
|
||||
CACHE_MIDDLEWARE_KEY_PREFIX = "cache_middleware"
|
||||
CACHE_MIDDLEWARE_SECONDS = 0
|
||||
CACHE_TTL = 60 * 10
|
||||
SESSION_ENGINE = "django.contrib.sessions.backends.cache"
|
||||
SESSION_CACHE_ALIAS = "default"
|
||||
CACHEOPS_DEFAULTS = {"timeout": 60 * 60}
|
||||
CACHEOPS = {
|
||||
"auth.user": {"ops": "get", "timeout": 60 * 15},
|
||||
"auth.*": {"ops": ("fetch", "get")},
|
||||
"auth.permission": {"ops": "all"},
|
||||
"*.*": {},
|
||||
"auth.*": {"ops": ("fetch", "get"), "timeout": 60 * 2},
|
||||
"blog.*": {"ops": ("fetch", "get"), "timeout": 15},
|
||||
"auth.permission": {"ops": "all", "timeout": 60 * 15},
|
||||
}
|
||||
CACHEOPS_REDIS = env.str("REDIS_URL")
|
||||
|
||||
|
@ -271,7 +271,6 @@
|
|||
"django.template.context_processors.tz",
|
||||
"django.contrib.messages.context_processors.messages",
|
||||
"akarpov.users.context_processors.allauth_settings",
|
||||
"sekizai.context_processors.sekizai",
|
||||
],
|
||||
},
|
||||
}
|
||||
|
|
|
@ -14,16 +14,6 @@
|
|||
ALLOWED_HOSTS = ["*"]
|
||||
CSRF_TRUSTED_ORIGINS = ["http://127.0.0.1", "https://*.akarpov.ru"]
|
||||
|
||||
# CACHES
|
||||
# ------------------------------------------------------------------------------
|
||||
# https://docs.djangoproject.com/en/dev/ref/settings/#caches
|
||||
CACHES = {
|
||||
"default": {
|
||||
"BACKEND": "django.core.cache.backends.locmem.LocMemCache",
|
||||
"LOCATION": "",
|
||||
}
|
||||
}
|
||||
|
||||
# EMAIL
|
||||
# ------------------------------------------------------------------------------
|
||||
# https://docs.djangoproject.com/en/dev/ref/settings/#email-host
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
from django.contrib.sitemaps.views import sitemap
|
||||
from django.urls import include, path, re_path
|
||||
from django.views import defaults as default_views
|
||||
from django.views.decorators.cache import cache_page
|
||||
from django.views.generic import TemplateView
|
||||
from drf_spectacular.views import (
|
||||
SpectacularAPIView,
|
||||
|
@ -16,7 +17,11 @@
|
|||
from config.sitemaps import sitemaps
|
||||
|
||||
urlpatterns = [
|
||||
path("home", TemplateView.as_view(template_name="pages/home.html"), name="home"),
|
||||
path(
|
||||
"home",
|
||||
cache_page(600)(TemplateView.as_view(template_name="pages/home.html")),
|
||||
name="home",
|
||||
),
|
||||
re_path(r"^robots\.txt", include("robots.urls")),
|
||||
path(
|
||||
"sitemap.xml",
|
||||
|
@ -29,7 +34,7 @@
|
|||
path(settings.ADMIN_URL, admin.site.urls),
|
||||
# User management
|
||||
path("users/", include("akarpov.users.urls", namespace="users")),
|
||||
path("about", about_view),
|
||||
path("about", cache_page(600)(about_view)),
|
||||
path("about/", include("akarpov.about.urls", namespace="about")),
|
||||
path("files/", include("akarpov.files.urls", namespace="files")),
|
||||
path("music/", include("akarpov.music.urls", namespace="music")),
|
||||
|
|
Loading…
Reference in New Issue
Block a user