google-code-export / django-photologue

Automatically exported from code.google.com/p/django-photologue
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Limit the number of files in a single dir #63

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

As far as I know (I am just discovering this amazing app),
all uploaded files are placed in the same dir. 
It would be a nice improvement to limit the number of file
by dir automatically creating new dir as needed 
(eg. 001, 002, ...).

For rationale, see youtube scalability speech at google video.
They explain there that they managed to reach that file limit
but I don't remember right what it was.

Original issue reported on code.google.com by ludovic....@gmail.com on 11 Aug 2008 at 7:15

GoogleCodeExporter commented 9 years ago
Well I was trying 2.0 preview 3 and for one reason or an another it seems to put
everything under the same dir.

I've just tested 1.0 and see that this issue is irrelevant. Sorry for the 
noise, I
guess the issue can be closed.

Original comment by ludovic....@gmail.com on 11 Aug 2008 at 8:08

GoogleCodeExporter commented 9 years ago
Photologue 1.0 stores the photos in a path defined by the date uploaded. Some 
users
didn't want the date path in the url so right now in Photologue 2 the files are 
all
uploaded to the same directory. Sometimes you can't win :). I'm looking a
implementing a more flexible solution soon that will allow users to customize 
where
the files are saved easier.

Original comment by justin.d...@gmail.com on 11 Aug 2008 at 12:12

GoogleCodeExporter commented 9 years ago
Trunk (r285) includes the ability to define a callable that takes a model 
instance
and the original filename and returns the relative path where that file will be
saved. This function can be defined in a module and passed to the setting as a 
string

settings.py:

PHOTOLOGUE_PATH = 'mymodule.get_storage_path'

Or defined in settings.py:

import os
def get_storage_path(instance, filename):
    return os.path.join('path', 'to', 'my', 'files', filename)

PHOTOLOGUE_PATH = get_storage_path

This should allow you to easily customize where Photologue stores it's files. 
This
could change before the final release.

Original comment by justin.d...@gmail.com on 11 Aug 2008 at 2:10

GoogleCodeExporter commented 9 years ago
Would be sweet if the default behaviour was the previous "photos/y/m/d/" and 
folks 
could override if they wanted, instead of changing default behaviour to 
"photos/"

Original comment by tapaut...@gmail.com on 15 Aug 2008 at 12:23