Open mia1024 opened 6 years ago
I can reproduce this problem on my development machine by deleting the folder CACHE
after it is created. I think a potential solution is to run a cron that regenerate the entire cache. However, I don't know how to manually generate all caches
After deleting the CACHE
folder you need to clear the cache that stores the information that files are generated already.
Depending on the cache configured in your settings you have different options:
If you do not have CACHES
in your settings this means that you are using locmem
by default and server restart is enough
If You are using some other external cache (memcached
, redis
etc.) then you need to clear it by opening the shell and executing the following:
from imagekit.utils import get_cache
cache = get_cache()
cache.clear()
If you are using external cache and also you are using django-extensions
then you can execute:
python manage.py clear_cache
+1 this problem has happened to me
But it's interesting why caches disappeared !)
@ArtemBernatskyy and I already give a solution how to fix it.
Is there anyone willing to give better solution?
@vstoykov but as far as i understand it will clear WHOLE cache, isn't it ? But can we clear ONLY django-imagekit
related cache ?
Depends on how you configure your cache. If you configured imagekit to use the same cache as everything else (actually this is the default) then you will clear everything. If you want them to be separated than you need to configure different caches in settings.CACHES
and point IMAGEKIT_CACHE_BACKEND
to the other cache. Then you need to clear only that cache.
@pkqxdd @ArtemBernatskyy did you think that there is still issue with ImageKit or we can close the issue?
I can’t reproduce the issue, closing till someone will found a way to reproduce it.
What happens in production, is it the same behavior? And yes if you are using default cache locmem, restarting the server is enough to generate the cache thumbnails.
Hi, I'm currently using ImageSpecField. However, the cached files disappeared and I got 404 errors instead. I don't know why caches disappear, but when they do, they are not regenerated. I did not hardcode anything link in my template.
Here is my model definition
And the relevant part in my template: