Skip to content

Provides a proxy for django file storage, that allows you to upload files locally and eventually serve them remotely. A local fork for trying out some enhancements.

License

Notifications You must be signed in to change notification settings

malcolmt/django-queued-storage

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

django-queued-storage
=================

This is a storage backend that allows you specify a local and a remote storage backend. 
It will upload locally and then queue up the transfer to your remote backend. If any 
request for the file occur before the file gets to the remote backend your local backend
will be used. Once the file has been successfully transferred to the remote backend all
request for the file will use the remote backend.

This backend requires celery, which is used for the queuing.

Example
----------------------------
>>>from queued_storage.backend import QueuedRemoteStorage
>>>storage = QueuedRemoteStorage(local='django.core.files.storage.FileSystemStorage', remote='backends.s3boto.S3BotoStorage')
>>>storage.save(fname, file)
>>>storage.url(fname)
<<<u'/uploads/myfile.jpg'
>>>storage.using_local(fname)
<<<True
>>>storage.using_remote(fname)
<<<False
>>>time.sleep(30)
>>>storage.url(fname)
<<<u'https://mybucket.s3.amazonaws.com/uploads/myfile.jpg'
>>>storage.using_local(fname)
<<<False
>>>storage.using_remote(fname)
<<<True

Installation
----------------------------

1. Make sure celery is installed and running https://ask.github.com/celery/introduction.html

2. Make sure you have a cache backend set up.

3. Add the backend to the storage argument of a FileField
		
		image = ImageField(storage=QueuedRemoteStorage(local='django.core.files.storage.FileSystemStorage',
		                   remote='backends.s3boto.S3BotoStorage'), upload_to='uploads')

About

Provides a proxy for django file storage, that allows you to upload files locally and eventually serve them remotely. A local fork for trying out some enhancements.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%