docker fix

This commit is contained in:
Alexander Karpov 2023-01-03 10:58:52 +03:00
parent 49d29e127b
commit fb50713ecc
6 changed files with 13 additions and 17 deletions

View File

@ -1,6 +1,6 @@
DATABASE_URL=postgres://postgres:postgres@127.0.0.1:5432/akarpov DATABASE_URL=postgres://postgres:postgres@127.0.0.1:5432/akarpov
CELERY_BROKER_URL=redis://localhost:6379/0 CELERY_BROKER_URL=redis://localhost:6379/0
REDIS_URL=redis://localhost:6379/1 REDIS_URL=redis://localhost:6379/1
REDIS_HOST=localhost REDIS_CACHE=rediscache://localhost:6379/1
USE_DOCKER=no USE_DOCKER=no
EMAIL_HOST=127.0.0.1:8025 EMAIL_HOST=127.0.0.1:8025

View File

@ -6,6 +6,7 @@ DJANGO_READ_DOT_ENV_FILE=no
# Redis # Redis
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
REDIS_URL=redis://redis:6379/1 REDIS_URL=redis://redis:6379/1
REDIS_CACHE=rediscache://redis:6379/1
CELERY_BROKER_URL=redis://redis:6379/0 CELERY_BROKER_URL=redis://redis:6379/0
# Celery # Celery

View File

@ -55,4 +55,3 @@ jobs:
- name: Tear down the Stack - name: Tear down the Stack
run: docker-compose -f local.yml down run: docker-compose -f local.yml down

View File

@ -56,14 +56,7 @@
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
CACHE_TTL = 60 * 1500 CACHE_TTL = 60 * 1500
CACHES = { CACHES = {"default": env.cache("REDIS_CACHE")}
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": env.db("REDIS_URL"),
"OPTIONS": {"CLIENT_CLASS": "django_redis.client.DefaultClient"},
"KEY_PREFIX": "example",
}
}
SESSION_ENGINE = "django.contrib.sessions.backends.cache" SESSION_ENGINE = "django.contrib.sessions.backends.cache"
SESSION_CACHE_ALIAS = "default" SESSION_CACHE_ALIAS = "default"
CACHEOPS_DEFAULTS = {"timeout": 60 * 60} CACHEOPS_DEFAULTS = {"timeout": 60 * 60}
@ -73,11 +66,7 @@
"auth.permission": {"ops": "all"}, "auth.permission": {"ops": "all"},
"*.*": {}, "*.*": {},
} }
CACHEOPS_REDIS = { CACHEOPS_REDIS = env.str("REDIS_URL")
"host": env.db("REDIS_HOST", default="redis"),
"port": 6379, # default redis port
"db": 1,
}
# URLS # URLS
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -201,6 +190,7 @@
# https://docs.djangoproject.com/en/dev/ref/settings/#middleware # https://docs.djangoproject.com/en/dev/ref/settings/#middleware
MIDDLEWARE = [ MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware", "django.middleware.security.SecurityMiddleware",
"django.middleware.cache.UpdateCacheMiddleware",
"corsheaders.middleware.CorsMiddleware", "corsheaders.middleware.CorsMiddleware",
"whitenoise.middleware.WhiteNoiseMiddleware", "whitenoise.middleware.WhiteNoiseMiddleware",
"django_structlog.middlewares.RequestMiddleware", "django_structlog.middlewares.RequestMiddleware",
@ -212,6 +202,11 @@
"django.contrib.messages.middleware.MessageMiddleware", "django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.common.BrokenLinkEmailsMiddleware", "django.middleware.common.BrokenLinkEmailsMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware",
"cms.middleware.language.LanguageCookieMiddleware",
"cms.middleware.user.CurrentUserMiddleware",
"cms.middleware.page.CurrentPageMiddleware",
"cms.middleware.toolbar.ToolbarMiddleware",
"django.middleware.cache.FetchFromCacheMiddleware",
] ]
# STATIC # STATIC

3
poetry.lock generated
View File

@ -196,6 +196,7 @@ click-plugins = ">=1.1.1"
click-repl = ">=0.2.0" click-repl = ">=0.2.0"
kombu = ">=5.2.3,<6.0" kombu = ">=5.2.3,<6.0"
pytz = ">=2021.3" pytz = ">=2021.3"
redis = {version = ">=3.4.1,<4.0.0 || >4.0.0,<4.0.1 || >4.0.1", optional = true, markers = "extra == \"redis\""}
vine = ">=5.0.0,<6.0" vine = ">=5.0.0,<6.0"
[package.extras] [package.extras]
@ -2186,7 +2187,7 @@ python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7"
[metadata] [metadata]
lock-version = "1.1" lock-version = "1.1"
python-versions = "^3.11" python-versions = "^3.11"
content-hash = "e053f66444cdba0601b76b4df7fc989041a1f8aeaeceaf3ef9270fb8e93d7e82" content-hash = "6758ffa352939b433d2b84408b087e8038e75762703b4831d7a2300c1fb69853"
[metadata.files] [metadata.files]
alabaster = [ alabaster = [

View File

@ -15,7 +15,7 @@ argon2-cffi = "^21.3.0"
whitenoise = "^6.2.0" whitenoise = "^6.2.0"
redis = "^4.4.0" redis = "^4.4.0"
hiredis = "^2.1.0" hiredis = "^2.1.0"
celery = "^5.2.7" celery = {extras = ["redis"], version = "^5.2.7"}
django-celery-beat = "^2.4.0" django-celery-beat = "^2.4.0"
flower = "^1.2.0" flower = "^1.2.0"
django = "^4.1.4" django = "^4.1.4"