Add memcached config

This commit is contained in:
Gabriel Augendre 2021-01-05 02:36:20 +01:00
parent 9958b37699
commit 3c64795f7a
No known key found for this signature in database
GPG key ID: 1E693F4CE4AEE7B4
4 changed files with 34 additions and 1 deletions

View file

@ -10,6 +10,11 @@ ENV PYTHONPATH $PYTHONPATH:/root/.poetry/lib
ARG POETRY_OPTIONS ARG POETRY_OPTIONS
WORKDIR /app WORKDIR /app
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libmemcached-dev
COPY pyproject.toml poetry.lock ./ COPY pyproject.toml poetry.lock ./
RUN python -m venv --copies /app/venv \ RUN python -m venv --copies /app/venv \
@ -31,6 +36,10 @@ FROM python:3.8.6-slim-buster as prod
RUN echo "Europe/Paris" > /etc/timezone \ RUN echo "Europe/Paris" > /etc/timezone \
&& mkdir /db && mkdir /db
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libmemcached-dev
COPY --from=venv /app/venv /app/venv/ COPY --from=venv /app/venv /app/venv/
ENV PATH /app/venv/bin:$PATH ENV PATH /app/venv/bin:$PATH

View file

@ -109,6 +109,14 @@ TEMPLATES = [
WSGI_APPLICATION = "blog.wsgi.application" WSGI_APPLICATION = "blog.wsgi.application"
MEMCACHED_LOCATION = os.getenv("MEMCACHED_LOCATION")
if MEMCACHED_LOCATION:
CACHES = {
"default": {
"BACKEND": "django.core.cache.backends.memcached.PyLibMCCache",
"LOCATION": MEMCACHED_LOCATION,
}
}
# Database # Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases # https://docs.djangoproject.com/en/3.1/ref/settings/#databases

17
poetry.lock generated
View file

@ -378,6 +378,14 @@ category = "main"
optional = false optional = false
python-versions = ">=3.5" python-versions = ">=3.5"
[[package]]
name = "pylibmc"
version = "1.6.1"
description = "Quick and small memcached client for Python"
category = "main"
optional = false
python-versions = "*"
[[package]] [[package]]
name = "pyparsing" name = "pyparsing"
version = "2.4.7" version = "2.4.7"
@ -625,7 +633,7 @@ multidict = ">=4.0"
[metadata] [metadata]
lock-version = "1.1" lock-version = "1.1"
python-versions = "^3.8" python-versions = "^3.8"
content-hash = "e55cff591236bac6ee7f57a2da6cb48fcf0484f5a1d17a26949c3c724dad0087" content-hash = "95c3ac9ea5b53ca0646c04fe708143d8affe331c1a0b71204b59315f00347d4f"
[metadata.files] [metadata.files]
appdirs = [ appdirs = [
@ -921,6 +929,13 @@ pygments = [
{file = "Pygments-2.7.3-py3-none-any.whl", hash = "sha256:f275b6c0909e5dafd2d6269a656aa90fa58ebf4a74f8fcf9053195d226b24a08"}, {file = "Pygments-2.7.3-py3-none-any.whl", hash = "sha256:f275b6c0909e5dafd2d6269a656aa90fa58ebf4a74f8fcf9053195d226b24a08"},
{file = "Pygments-2.7.3.tar.gz", hash = "sha256:ccf3acacf3782cbed4a989426012f1c535c9a90d3a7fc3f16d231b9372d2b716"}, {file = "Pygments-2.7.3.tar.gz", hash = "sha256:ccf3acacf3782cbed4a989426012f1c535c9a90d3a7fc3f16d231b9372d2b716"},
] ]
pylibmc = [
{file = "pylibmc-1.6.1-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:01a7e2e3fa9fcd7a791c7818a80a07e7a381aee988a5d810a1c1e6f7a9a288fd"},
{file = "pylibmc-1.6.1-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:6fff384e3c30af029bbac87f88b3fab14ae87b50103d389341d9b3e633349a3f"},
{file = "pylibmc-1.6.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:c749b4251c1137837d00542b62992b96cd2aed639877407f66291120dd6de2ff"},
{file = "pylibmc-1.6.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:e6c0c452336db0868d0de521d48872c2a359b1233b974c6b32c36ce68abc4820"},
{file = "pylibmc-1.6.1.tar.gz", hash = "sha256:8a8dd406487d419d58c6d944efd91e8189b360a0c4d9e8c6ebe3990d646ae7e9"},
]
pyparsing = [ pyparsing = [
{file = "pyparsing-2.4.7-py2.py3-none-any.whl", hash = "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"}, {file = "pyparsing-2.4.7-py2.py3-none-any.whl", hash = "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"},
{file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"}, {file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"},

View file

@ -35,6 +35,7 @@ html2text = "^2020.1.16"
readtime = "^1.1.1" readtime = "^1.1.1"
django-compressor = "^2.4" django-compressor = "^2.4"
"calmjs.parse" = "^1.2.5" "calmjs.parse" = "^1.2.5"
pylibmc = "^1.6.1"
[tool.poetry.dev-dependencies] [tool.poetry.dev-dependencies]
pre-commit = "^2.7" pre-commit = "^2.7"