-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatically create sub directories #1
Comments
The |
This project might be dead, but this is definitely a useful suggestion. Its actually pretty crazy this isn't the default in django, I assume everyone wanting to use S3 has made issues like this go ignored. Anyone putting effort into this should prob write the documentation for https://github.com/adamzap/django-storages/blob/master/storages/backends/hashpath.py and contribute there, it is a much larger project that is likely to actually see some contributions |
@budlight Do you think we can abandon this project in favour of django-storages? We still maintain django-hashedfilenamestorage, but mostly only for issues that affect us. |
@jordiecometrica they do not document that storage class I believe even though it is included, also nobody has worked on it in quite some time, however I think if you were to contribute code it might be just as good to contribute it there notice no changes since the file was committed https://github.com/adamzap/django-storages/commits/master/storages/backends/hashpath.py |
I store my files on S3 and everything is straight key/object and there is no directory structure, so I would rather have the directory removed. I think these options should be provided as options at |
In the case when there are many files can take a long time to get their list. This problem is especially relevant when accessing via FTP.
To solve this problem, you can create subdirectories to give their names from the first three characters of the file name.
For example we have 3 files (alrady hashed):
For this example we build this directory tree:
I have a project containing nearly 30,000 images (more than 4 GB), and it uses this approach. But even in this case, if you access via FTP, requires a few seconds to receive a list of directories.
From the box Django provide
strftime()
formating forupload_to
parameter. But if you use this approach then we will upload the same files on different days. What if we extend these opportunities? Like this:For file
3ef8710a2481110fce9e962d998044e6523cffaa.mpg
this syntax says: put file intoMDEIA_ROOT/video/3ef/3ef8710a2481110fce9e962d998044e6523cffaa.mpg
More compex solution:
For file
3ef8710a2481110fce9e962d998044e6523cffaa.mpg
this syntax says: put file intoMDEIA_ROOT/video/2014/3ef/871/3ef8710a2481110fce9e962d998044e6523cffaa.mpg
The text was updated successfully, but these errors were encountered: