Skip to content

Implement a file storage backend in the database

Antoine Albertelli requested to merge fs-storage-db into master

This Storage backend stores uploaded files as binary blobs in the our database. Some initial benchmarking on the server shows that this is slightly slower than using the filesystem for this, but not significantly so. Since the current intent is to use that for organizer logos, this will be sufficiently low traffic that scalability does not matter so much.

On the other hand, using the database as a file storage backend has quite some advantages for us:

  • Every data is still self-contained in a single file that can easily be moved around and backed up. The backup script requires no changes.
  • Files can be managed from the Django admin. It is not the most elegant UX, but it allows deleting files.
  • No changes to the deployment side: everything is still served by a single binary in a container that only needs to have access to the DB.

Not all file storage operations are currently supported, but enough to allow upload of a file attached to a model and later download of it. Tested by adding a simple field to one of the model (not included in this commit).

Merge request reports

Loading