Serve existing files you already have lying around. "Upload" them with a Django backend.
This package has two components: - packrat daemon: A tiny Django project to serve some files from a directory at URLs based on a hash of their contents. - A Django storage backend that "uploads" files by simply computing their hash and just assuming they already exist on a packrat daemon.
To serve files from the daemon:
- Run
packrat-add <directory>
to recursively add all the files in a directory to the packrat index. This will read their contents to compute hashes. - Run
packrat-daemon
.
To use the storage backend, add it to your settings like this:
- BACKENDS = (
- 'packrat.storage', {'URL': '<URL of the daemon you ran above>'}
)
'packrat.widget.FileUpload' is a file "uploading" widget that simply computes the hash of file data client-side, then send the has to the server.
WHY?
You have some potentially large files someplace you want to make use of in a web-app without having to copy them around.