django-queued-storage

Build Status

This storage backend enables having a local and a remote storage backend. It will save any file locally and queue a task to transfer it somewhere else using Celery.

If the file is accessed before it’s transferred, the local copy is returned.

Installation

pip install django-queued-storage

Configuration

Usage

The QueuedStorage can be used as a drop-in replacement wherever using django.core.files.storage.Storage might otherwise be required.

This example is using django-storages for the remote backend:

from django.db import models
from queued_storage.backends import QueuedStorage
from storages.backends.s3boto import S3BotoStorage

queued_s3storage = QueuedStorage(
    'django.core.files.storage.FileSystemStorage',
    'storages.backends.s3boto.S3BotoStorage')

class MyModel(models.Model):
    image = ImageField(storage=queued_s3storage)

Settings

queued_storage.conf.settings.QUEUED_STORAGE_CACHE_PREFIX
Default :'queued_storage'

The cache key prefix to use when caching the storage backends.

queued_storage.conf.settings.QUEUED_STORAGE_RETRIES
Default :5

How many retries should be attempted before aborting.

queued_storage.conf.settings.QUEUED_STORAGE_RETRY_DELAY
Default :60

The delay between retries in seconds.

Reference

For further details see the reference documentation:

Issues

For any bug reports and feature requests, please use the Github issue tracker.

Project Versions

Table Of Contents

Next topic

Backends

This Page