Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions imagefit/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ class ImagefitConf(AppConf):
IMAGEFIT_CACHE_ENABLED = True
IMAGEFIT_CACHE_BACKEND_NAME = 'imagefit'

settings.CACHES[IMAGEFIT_CACHE_BACKEND_NAME] = {
'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
'LOCATION': os.path.join(tempfile.gettempdir(), 'django_imagefit')
}
# On Django1.8, this overwrites all CACHES?
#settings.CACHES[IMAGEFIT_CACHE_BACKEND_NAME] = {
# 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
# 'LOCATION': os.path.join(tempfile.gettempdir(), 'django_imagefit')
#}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure about removing these lines? This is supposed to be the default IMAGEFIT_CACHE_BACKEND_NAME that should be overridable in the settings.
Do you have any doc/info relating your choice?


#: ConditionalGetMiddleware is required for browser caching
if not 'django.middleware.http.ConditionalGetMiddleware' in settings.MIDDLEWARE_CLASSES:
Expand Down
2 changes: 1 addition & 1 deletion imagefit/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def resize(request, path_name, format, url):
statobj = os.stat(image.path)
if not was_modified_since(request.META.get('HTTP_IF_MODIFIED_SINCE'),
statobj[stat.ST_MTIME], statobj[stat.ST_SIZE]):
return HttpResponseNotModified(mimetype=image.mimetype)
return HttpResponseNotModified() #mimetype=image.mimetype)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you remove the comment #mimetype=image.mimetype) here?
If we get rid of it let's just clear it out


if settings.IMAGEFIT_CACHE_ENABLED:
image.cache = cache
Expand Down