Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 43 lines (33 sloc) 1.489 kB
4e7c713 @seanbrant updated README for real
seanbrant authored
1 django-queued-storage
2 =================
3
4 This is a storage backend that allows you specify a local and a remote storage backend.
5 It will upload locally and then queue up the transfer to your remote backend. If any
6 request for the file occur before the file gets to the remote backend your local backend
7 will be used. Once the file has been successfully transferred to the remote backend all
8 request for the file will use the remote backend.
9
10 This backend requires celery, which is used for the queuing.
11
9487a3d @seanbrant Add a better usage
seanbrant authored
12 Example
13 ----------------------------
14 >>>from queued_storage.backend import QueuedRemoteStorage
15 >>>storage = QueuedRemoteStorage(local='django.core.files.storage.FileSystemStorage', remote='backends.s3boto.S3BotoStorage')
16 >>>storage.save(fname, file)
17 >>>storage.url(fname)
8c0f36e @seanbrant .
seanbrant authored
18 <<<u'/uploads/myfile.jpg'
9487a3d @seanbrant Add a better usage
seanbrant authored
19 >>>storage.using_local(fname)
20 <<<True
21 >>>storage.using_remote(fname)
22 <<<False
23 >>>time.sleep(30)
24 >>>storage.url(fname)
8c0f36e @seanbrant .
seanbrant authored
25 <<<u'http://mybucket.s3.amazonaws.com/uploads/myfile.jpg'
9487a3d @seanbrant Add a better usage
seanbrant authored
26 >>>storage.using_local(fname)
27 <<<False
b5ce850 @seanbrant Add a better usage
seanbrant authored
28 >>>storage.using_remote(fname)
9487a3d @seanbrant Add a better usage
seanbrant authored
29 <<<True
30
31 Installation
4e7c713 @seanbrant updated README for real
seanbrant authored
32 ----------------------------
33
34 1. Make sure celery is installed and running http://ask.github.com/celery/introduction.html
35
36 2. Make sure you have a cache backend set up.
37
2c84bc8 @seanbrant READ ME FIX
seanbrant authored
38 3. Add the backend to the storage argument of a FileField
4e7c713 @seanbrant updated README for real
seanbrant authored
39
40 image = ImageField(storage=QueuedRemoteStorage(local='django.core.files.storage.FileSystemStorage',
41 remote='backends.s3boto.S3BotoStorage'), upload_to='uploads')
42
Something went wrong with that request. Please try again.