matthewwithanm / django-imagekit

Automated image processing for Django. Currently v4.0
http://django-imagekit.rtfd.org/
BSD 3-Clause "New" or "Revised" License
2.24k stars 276 forks source link

Is django-imagekit dead? #559

Closed ericmuijs closed 1 year ago

ericmuijs commented 1 year ago

The last accepted Pull Request is 2 years ago, is django-imagekit still alive? I really like the package :) Currently I would like to integrate django-imagekit with django 4.2. I'm having issue with the new CACHE and STORAGES configurations, which do not match with IMAGEKIT CACHE settings.

philgyford commented 1 year ago

I can't answer whether it's dead or not, but after upgrading to Django 4.2 I had to do explicitly define IMAGEKIT_DEFAULT_FILE_STORAGE. To explain:

I'm using storages.backends.s3boto3.S3Boto3Storage for Media files to be stored on S3, and Static files locally, so previously had this in my settings:

DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
STATICFILES_STORAGE = "django.contrib.staticfiles.storage.StaticFilesStorage"
MEDIA_URL = "https://my-bucket-name.s3.amazonaws.com/media/"

Imagekit saved cache files to within that media directory on S3.

When updating to Django 4.2's STORAGES settings I combined the first two settings:

STORAGES = {
    "default": {
        "BACKEND": "storages.backends.s3boto3.S3Boto3Storage",
    },
    "staticfiles": {
        "BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage",
    },
}

All good. Except all the Imagekit cache files on my site were broken.

When I emptied my cache and did ./manage.py generateimages Imagekit regenerated all the cache files on the local filesystem - URLs on the website were still looking for them on S3.

I had to explicitly tell Imagekit to use the default file storage:

IMAGEKIT_DEFAULT_FILE_STORAGE = STORAGES["default"]["BACKEND"]

Emptying the cache and generating the images again got them back on S3.

vstoykov commented 1 year ago

@ericmuijs the project is not dead. Just I did not have enough time to properly carry for it. I just reviewed few of the opened PRs and merged them.

If there is someone willing to prepare a PR for upgrading the imagekit to latest Django I'll happily merge it. Then I can release a new version.

ericmuijs commented 1 year ago

@vstoykov : thanks for the quick response! Happy to hear that the package is still developed /carred for. @philgyford : thanks for the solution