Hi.
This must have been asked many times already, but I can't find where.
We're moving from an existing django-cms implementation using django-filebrowser to django-filer, and I'm trying to figure out the best way to populate the database.
Resources are on a local file system, and most of them are just referenced in HTML pages and mapped by the web server, so I'm looking for a way to:
- import existing files "in-place", i.e. just insert relevant data in the database by reading them from the file, without overwriting or copying it, preserving the folder structure relative to the root
- migrate filebrowser fields: this is just a matter of adding a new field, fetching the right Image and finally removing the legacy field and fix field names (and possibly indexes)
Step 2 should be fairly easy to implement within a South data migration (surrounded by schema migrations to add filer's fields and remove filebrowser's).
Now I'm stuck on step 1, because I can't find a way to create a new Image or File without having it fed to the storage and saved as a new file.
I understand that Filer's storage management is much more generic than a basic file system (so, for instance, checking upon path collision whether an existing file is an exact copy of the one I'm saving might not always be easy), so I'm considering writing data directly to the database (I know, it stinks, that's why I'm here). Alternatively we could just import all the files (using Filer's management command) and then just swap the root folders both on the file system and in Filer settings. I'd rather not have to modify folder mappings on the web server.
Has anyone already gone through this? How did you do it? How would you do it?
Thank you.
Stefano