From 734aa6073bbad8a91fb33b8c2db901639e06b50a Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Tue, 17 Jan 2023 13:09:43 -0500 Subject: [PATCH] Add cachalot to help fix slow views --- poetry.lock | 24 ++++++++++++++++-------- pyproject.toml | 1 + vrobbler/settings.py | 1 + 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/poetry.lock b/poetry.lock index bc8843a..b1ddf25 100644 --- a/poetry.lock +++ b/poetry.lock @@ -378,6 +378,17 @@ python3-openid = ">=3.0.8" requests = "*" requests-oauthlib = ">=0.3.0" +[[package]] +name = "django-cachalot" +version = "2.5.2" +description = "Caches your Django ORM queries and automatically invalidates them." +category = "main" +optional = false +python-versions = "*" + +[package.dependencies] +Django = ">=2.2,<4.2" + [[package]] name = "django-celery-results" version = "2.4.0" @@ -1476,7 +1487,7 @@ testing = ["flake8 (<5)", "func-timeout", "jaraco.functools", "jaraco.itertools" [metadata] lock-version = "1.1" python-versions = "^3.8" -content-hash = "39b4ea9b1b67a317d159760bff3def91ead580997052759a3f64521044e0b5ae" +content-hash = "f2e10b828fa5d1a92dd93e7549c06425b4b70a7910f57d22f56e4c6ad9d80a00" [metadata.files] amqp = [ @@ -1742,6 +1753,10 @@ django = [ django-allauth = [ {file = "django-allauth-0.50.0.tar.gz", hash = "sha256:ee3a174e249771caeb1d037e64b2704dd3c56cfec44f2058fae2214b224d35e8"}, ] +django-cachalot = [ + {file = "django-cachalot-2.5.2.tar.gz", hash = "sha256:bf0420cb8fa5cb4ceebd373a069cf91bb7afb995850cc35e91ccdadfa6cc41b1"}, + {file = "django_cachalot-2.5.2-py3-none-any.whl", hash = "sha256:7db091320ae352e9ad88c22336cff8d64fb928571287f1fae5299a187fc1a17e"}, +] django-celery-results = [ {file = "django_celery_results-2.4.0-py3-none-any.whl", hash = "sha256:be91307c02fbbf0dda21993c3001c60edb74595444ccd6ad696552fe3689e85b"}, {file = "django_celery_results-2.4.0.tar.gz", hash = "sha256:75aa51970db5691cbf242c6a0ff50c8cdf419e265cd0e9b772335d06436c4b99"}, @@ -2029,13 +2044,6 @@ pbr = [ {file = "pbr-5.11.0.tar.gz", hash = "sha256:b97bc6695b2aff02144133c2e7399d5885223d42b7912ffaec2ca3898e673bfe"}, ] pillow = [ - {file = "Pillow-9.4.0-1-cp310-cp310-macosx_10_10_x86_64.whl", hash = "sha256:1b4b4e9dda4f4e4c4e6896f93e84a8f0bcca3b059de9ddf67dac3c334b1195e1"}, - {file = "Pillow-9.4.0-1-cp311-cp311-macosx_10_10_x86_64.whl", hash = "sha256:fb5c1ad6bad98c57482236a21bf985ab0ef42bd51f7ad4e4538e89a997624e12"}, - {file = "Pillow-9.4.0-1-cp37-cp37m-macosx_10_10_x86_64.whl", hash = "sha256:f0caf4a5dcf610d96c3bd32932bfac8aee61c96e60481c2a0ea58da435e25acd"}, - {file = "Pillow-9.4.0-1-cp38-cp38-macosx_10_10_x86_64.whl", hash = "sha256:3f4cc516e0b264c8d4ccd6b6cbc69a07c6d582d8337df79be1e15a5056b258c9"}, - {file = "Pillow-9.4.0-1-cp39-cp39-macosx_10_10_x86_64.whl", hash = "sha256:b8c2f6eb0df979ee99433d8b3f6d193d9590f735cf12274c108bd954e30ca858"}, - {file = "Pillow-9.4.0-1-pp38-pypy38_pp73-macosx_10_10_x86_64.whl", hash = "sha256:b70756ec9417c34e097f987b4d8c510975216ad26ba6e57ccb53bc758f490dab"}, - {file = "Pillow-9.4.0-1-pp39-pypy39_pp73-macosx_10_10_x86_64.whl", hash = "sha256:43521ce2c4b865d385e78579a082b6ad1166ebed2b1a2293c3be1d68dd7ca3b9"}, {file = "Pillow-9.4.0-cp310-cp310-macosx_10_10_x86_64.whl", hash = "sha256:2968c58feca624bb6c8502f9564dd187d0e1389964898f5e9e1fbc8533169157"}, {file = "Pillow-9.4.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c5c1362c14aee73f50143d74389b2c158707b4abce2cb055b7ad37ce60738d47"}, {file = "Pillow-9.4.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bd752c5ff1b4a870b7661234694f24b1d2b9076b8bf337321a814c612665f343"}, diff --git a/pyproject.toml b/pyproject.toml index ba0d638..204181a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,6 +30,7 @@ whitenoise = "^6.3.0" musicbrainzngs = "^0.7.1" cinemagoer = "^2022.12.27" pysportsdb = "^0.1.0" +django-cachalot = "^2.5.2" [tool.poetry.dev-dependencies] Werkzeug = "2.0.3" diff --git a/vrobbler/settings.py b/vrobbler/settings.py index d499c73..7226b1e 100644 --- a/vrobbler/settings.py +++ b/vrobbler/settings.py @@ -81,6 +81,7 @@ INSTALLED_APPS = [ "django_filters", "django_extensions", 'rest_framework.authtoken', + "cachalot", "scrobbles", "videos", "music",