Removed django-cacheops dependency
This commit is contained in:
parent
9a8de804cf
commit
3a94462bd6
1
.env.dev
1
.env.dev
|
@ -10,5 +10,4 @@ PYTHONDONTWRITEBYTECODE=true
|
||||||
WEBPACK_DEVSERVER_PORT=8080
|
WEBPACK_DEVSERVER_PORT=8080
|
||||||
MUSIC_DIRECTORY_PATH=/music
|
MUSIC_DIRECTORY_PATH=/music
|
||||||
BROWSABLE_API_ENABLED=True
|
BROWSABLE_API_ENABLED=True
|
||||||
CACHEOPS_ENABLED=False
|
|
||||||
FORWARDED_PROTO=http
|
FORWARDED_PROTO=http
|
||||||
|
|
|
@ -143,7 +143,6 @@ test_api:
|
||||||
DJANGO_ALLOWED_HOSTS: "localhost"
|
DJANGO_ALLOWED_HOSTS: "localhost"
|
||||||
DATABASE_URL: "postgresql://postgres@postgres/postgres"
|
DATABASE_URL: "postgresql://postgres@postgres/postgres"
|
||||||
FUNKWHALE_URL: "https://funkwhale.ci"
|
FUNKWHALE_URL: "https://funkwhale.ci"
|
||||||
CACHEOPS_ENABLED: "false"
|
|
||||||
DJANGO_SETTINGS_MODULE: config.settings.local
|
DJANGO_SETTINGS_MODULE: config.settings.local
|
||||||
only:
|
only:
|
||||||
- branches
|
- branches
|
||||||
|
|
|
@ -92,7 +92,6 @@ THIRD_PARTY_APPS = (
|
||||||
"rest_auth.registration",
|
"rest_auth.registration",
|
||||||
"dynamic_preferences",
|
"dynamic_preferences",
|
||||||
"django_filters",
|
"django_filters",
|
||||||
"cacheops",
|
|
||||||
"django_cleanup",
|
"django_cleanup",
|
||||||
"versatileimagefield",
|
"versatileimagefield",
|
||||||
)
|
)
|
||||||
|
@ -421,15 +420,6 @@ PROTECT_FILES_PATH = env("PROTECT_FILES_PATH", default="/_protected")
|
||||||
# use this setting to tweak for how long you want to cache
|
# use this setting to tweak for how long you want to cache
|
||||||
# musicbrainz results. (value is in seconds)
|
# musicbrainz results. (value is in seconds)
|
||||||
MUSICBRAINZ_CACHE_DURATION = env.int("MUSICBRAINZ_CACHE_DURATION", default=300)
|
MUSICBRAINZ_CACHE_DURATION = env.int("MUSICBRAINZ_CACHE_DURATION", default=300)
|
||||||
CACHEOPS_REDIS = env("CACHE_URL", default=CACHE_DEFAULT)
|
|
||||||
CACHEOPS_ENABLED = env.bool("CACHEOPS_ENABLED", default=True)
|
|
||||||
CACHEOPS = {
|
|
||||||
"music.artist": {"ops": "all", "timeout": 60 * 60},
|
|
||||||
"music.album": {"ops": "all", "timeout": 60 * 60},
|
|
||||||
"music.track": {"ops": "all", "timeout": 60 * 60},
|
|
||||||
"music.trackfile": {"ops": "all", "timeout": 60 * 60},
|
|
||||||
"taggit.tag": {"ops": "all", "timeout": 60 * 60},
|
|
||||||
}
|
|
||||||
|
|
||||||
# Custom Admin URL, use {% url 'admin:index' %}
|
# Custom Admin URL, use {% url 'admin:index' %}
|
||||||
ADMIN_URL = env("DJANGO_ADMIN_URL", default="^api/admin/")
|
ADMIN_URL = env("DJANGO_ADMIN_URL", default="^api/admin/")
|
||||||
|
|
|
@ -51,12 +51,6 @@ CSRF_TRUSTED_ORIGINS = ALLOWED_HOSTS
|
||||||
|
|
||||||
# END SITE CONFIGURATION
|
# END SITE CONFIGURATION
|
||||||
|
|
||||||
# STORAGE CONFIGURATION
|
|
||||||
# ------------------------------------------------------------------------------
|
|
||||||
# Uploaded Media Files
|
|
||||||
# ------------------------
|
|
||||||
DEFAULT_FILE_STORAGE = "django.core.files.storage.FileSystemStorage"
|
|
||||||
|
|
||||||
# Static Assets
|
# Static Assets
|
||||||
# ------------------------
|
# ------------------------
|
||||||
STATICFILES_STORAGE = "django.contrib.staticfiles.storage.StaticFilesStorage"
|
STATICFILES_STORAGE = "django.contrib.staticfiles.storage.StaticFilesStorage"
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import cacheops
|
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
@ -24,7 +23,6 @@ class Command(BaseCommand):
|
||||||
self.fix_mimetypes(**options)
|
self.fix_mimetypes(**options)
|
||||||
self.fix_file_data(**options)
|
self.fix_file_data(**options)
|
||||||
self.fix_file_size(**options)
|
self.fix_file_size(**options)
|
||||||
cacheops.invalidate_model(models.TrackFile)
|
|
||||||
|
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
def fix_mimetypes(self, dry_run, **kwargs):
|
def fix_mimetypes(self, dry_run, **kwargs):
|
||||||
|
|
|
@ -107,13 +107,6 @@ class PlaylistSerializer(serializers.ModelSerializer):
|
||||||
covers = []
|
covers = []
|
||||||
max_covers = 5
|
max_covers = 5
|
||||||
for plt in plts:
|
for plt in plts:
|
||||||
if not hasattr(plt.track.album.cover, "crop"):
|
|
||||||
# In some rare situations, we end up with the following stack strace:
|
|
||||||
# AttributeError: 'VersatileImageFieldFile' object has no attribute 'crop'
|
|
||||||
# I tend to thing our complex prefetch logic is troubling for versatile
|
|
||||||
# image field, so wi initialize the missing attribute by hand, cf
|
|
||||||
# https://github.com/respondcreate/django-versatileimagefield/blob/1.9/versatileimagefield/mixins.py#L108
|
|
||||||
plt.track.album.cover.build_filters_and_sizers((0.5, 0, 5), False)
|
|
||||||
url = plt.track.album.cover.crop["200x200"].url
|
url = plt.track.album.cover.crop["200x200"].url
|
||||||
if url in covers:
|
if url in covers:
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -58,7 +58,6 @@ python-magic==0.4.15
|
||||||
ffmpeg-python==0.1.10
|
ffmpeg-python==0.1.10
|
||||||
channels>=2,<2.1
|
channels>=2,<2.1
|
||||||
channels_redis>=2.1,<2.2
|
channels_redis>=2.1,<2.2
|
||||||
django-cacheops>=4,<4.1
|
|
||||||
|
|
||||||
daphne==2.0.4
|
daphne==2.0.4
|
||||||
cryptography>=2,<3
|
cryptography>=2,<3
|
||||||
|
|
|
@ -18,5 +18,4 @@ env =
|
||||||
EMAIL_CONFIG=consolemail://
|
EMAIL_CONFIG=consolemail://
|
||||||
CELERY_BROKER_URL=memory://
|
CELERY_BROKER_URL=memory://
|
||||||
CELERY_TASK_ALWAYS_EAGER=True
|
CELERY_TASK_ALWAYS_EAGER=True
|
||||||
CACHEOPS_ENABLED=False
|
|
||||||
FEDERATION_HOSTNAME=test.federation
|
FEDERATION_HOSTNAME=test.federation
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
Removed django-cacheops dependency
|
||||||
|
|
||||||
|
Removed Cacheops dependency
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
We removed one of our dependency named django-cacheops. It was unly used in a few places,
|
||||||
|
and not playing nice with other dependencies.
|
||||||
|
|
||||||
|
You can safely remove this dependency in your environment with ``pip uninstall django-cacheops`` if you're
|
||||||
|
not using docker.
|
||||||
|
|
||||||
|
You can also safely remove any ``CACHEOPS_ENABLED`` setting from your environment file.
|
Loading…
Reference in New Issue