Using a different cache directory for some specs

40 visualizações
Ir para a primeira mensagem não lida

Graeme

não lida,
10/05/2013, 03:13:4710/05/13
para django-...@googlegroups.com
I need to have a different cache directory for some ImageSpecs.

The reason is that these images should only be visible to logged in users. I am planning to use lighttpd mod_secdownload, but this secures a full directory - and there are lots of other ImageSpecs producing images that should be publicly visible.

If it makes it any easier, the images that need the separate cache directory are all on the same model and in a separate app from anything else.

Is this possible with Imagekit 3?

matthewwithanm

não lida,
10/05/2013, 13:41:0110/05/13
para django-...@googlegroups.com
I may tweak how directories are handled to give a little more control over this, but in your case I don't think this is actually what you want. I think a separate storage object would make more sense, since you want to store the files outside of MEDIA_ROOT, right? In that case, you can provide a different one by defining a cachefile_storage property on your spec class.

Graeme

não lida,
13/05/2013, 03:58:1113/05/13
para django-...@googlegroups.com
You are right. I was being stupid. I am using a storage object anyway as the ImageField should not be storing the original within media root, so it was not even a full line of extra code to add it.

Matthew Tretter

não lida,
13/05/2013, 10:00:3713/05/13
para django-...@googlegroups.com


That's what I like to hear! (Well, not the "stupid" stuff, but the "less than one line" stuff!)
Responder a todos
Responder ao autor
Reencaminhar
0 mensagens novas