mirror of
https://github.com/daniviga/django-ram.git
synced 2025-08-03 20:57:50 +02:00
Update examples to implement caching
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
# vim: syntax=python
|
# vim: syntax=python
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Django local_settings for ram project.
|
Example of changes suitable for production
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# SECURITY WARNING: keep the secret key used in production secret!
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
@@ -12,9 +13,23 @@ SECRET_KEY = (
|
|||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
|
|
||||||
|
# SECURITY WARNING: cache middlewares must be loaded before cookies one
|
||||||
|
MIDDLEWARE = [
|
||||||
|
"django.middleware.cache.UpdateCacheMiddleware",
|
||||||
|
"django.middleware.common.CommonMiddleware",
|
||||||
|
"django.middleware.cache.FetchFromCacheMiddleware",
|
||||||
|
] + settings.MIDDLEWARE
|
||||||
|
|
||||||
|
CACHES = {
|
||||||
|
"default": {
|
||||||
|
"BACKEND": "django.core.cache.backends.redis.RedisCache",
|
||||||
|
"LOCATION": "redis://127.0.0.1:6379",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CACHE_MIDDLEWARE_SECONDS = 300
|
||||||
STORAGE_DIR = BASE_DIR / "storage"
|
STORAGE_DIR = BASE_DIR / "storage"
|
||||||
ALLOWED_HOSTS = ["127.0.0.1"]
|
ALLOWED_HOSTS = ["127.0.0.1", "myhost"]
|
||||||
CSRF_TRUSTED_ORIGINS = ["https://myhost"]
|
CSRF_TRUSTED_ORIGINS = ["https://myhost"]
|
||||||
ROOT_URLCONF = "ram.urls"
|
|
||||||
STATIC_URL = "static/"
|
STATIC_URL = "static/"
|
||||||
MEDIA_URL = "media/"
|
MEDIA_URL = "media/"
|
||||||
|
@@ -1 +1,2 @@
|
|||||||
gunicorn
|
gunicorn
|
||||||
|
pylibmc
|
||||||
|
Reference in New Issue
Block a user