google-code-export / django-photologue

Automatically exported from code.google.com/p/django-photologue
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Support Amazon S3 for image file storage. #25

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm going to be working on some S3 integration for another project and I
may look into this.

Original issue reported on code.google.com by justin.d...@gmail.com on 4 Mar 2008 at 8:50

GoogleCodeExporter commented 9 years ago
Is there any progress on support for S3? 
I will be glad to volunteer sometime if you want. 

Thanks
Vinay

Original comment by vinay.ba...@gmail.com on 10 Jul 2008 at 5:32

GoogleCodeExporter commented 9 years ago
There should be a new file storage mechanism in Django soon and will support an 
S3
backend. Once this is complete you'll be able to configure where your photos are
stored either in Photologue of Django itself. Here a discussion on the Django
developers list that links to the projects in development:

http://groups.google.com/group/django-developers/browse_thread/thread/3726d0d528
ac50ca

Original comment by justin.d...@gmail.com on 11 Jul 2008 at 1:23

GoogleCodeExporter commented 9 years ago
Were you able to figure it out? Has anybody a working S3 storage for Photologue?
Thanks,
Lukasz

Original comment by lukasz.o...@gmail.com on 18 Sep 2008 at 9:21

GoogleCodeExporter commented 9 years ago
There's a thread going on in the discussion group about this and how to make 
Photologue compatible. If you would like to help out that would be great.

http://groups.google.com/group/django-
photologue/browse_thread/thread/a42286c578acc76b

Original comment by justin.d...@gmail.com on 18 Sep 2008 at 12:21

GoogleCodeExporter commented 9 years ago
Here is my patch against trunk (or 2.1, that's the same).
I attached also S3 libraries that I use in my project.
At last I changed a bit the model to suit my needs (sorry, I need photo 
previews and
I want to order photo with drag & drop, so you need also jQuery).
Good luck and let me know about bugs.
Last but not least, I added these configuration in my settings:

# Amazon S3
from S3api import CallingFormat
S3_FILE_STORAGE = 'lib.S3Storage.S3Storage'
AWS_ACCESS_KEY_ID = "<your ID>"
AWS_SECRET_ACCESS_KEY = "<your secret key>"
AWS_STORAGE_BUCKET_NAME = "<your bucket>"
AWS_CALLING_FORMAT = CallingFormat.VANITY
AWS_HEADERS = {'Expires': 'Thu, 15 Apr 2015 20:00:00 GMT',
               'ExpiresDefault': "access plus 10 years",
               'Cache-Control': 'max-age=86400',
              }
# PHOTOLOGUE
PHOTOLOGUE_STORAGE_S3 = S3_FILE_STORAGE

Ciao.
Marco.

Original comment by marcob...@gmail.com on 8 Jan 2009 at 7:08

Attachments:

GoogleCodeExporter commented 9 years ago
@marcoberi:

Thank you so much, you have no idea how much your modifications has helped me.

Original comment by alex.e.j...@gmail.com on 20 Jan 2009 at 8:10

GoogleCodeExporter commented 9 years ago
@ marcoberi:

Could you please submit the complete photologue app that you are using? I tried 
to
apply the diff file and it is not working properly.

Thanks in advance.

Original comment by muta...@gmail.com on 29 Jan 2009 at 10:42

GoogleCodeExporter commented 9 years ago
hi justin,

can you please submit the whole code not the diff file? because it gives me an 
error
when I try to patch it!

Thank you.

Original comment by muta...@gmail.com on 15 Feb 2009 at 8:23

GoogleCodeExporter commented 9 years ago
I'm trying to patch it to photologue 2.2 but it doesn't work. I don't have 2.1 
version.

Original comment by muta...@gmail.com on 15 Feb 2009 at 8:25

GoogleCodeExporter commented 9 years ago
I'm sorry but I have not had a chance to create a patched branch for this. You 
can always download all previous 
releases by searching all downloads on the download page:

http://code.google.com/p/django-photologue/downloads/list?
can=1&q=&colspec=Filename+Summary+Uploaded+Size+DownloadCount

Original comment by justin.d...@gmail.com on 15 Feb 2009 at 1:52

GoogleCodeExporter commented 9 years ago
I don't think it's worth adding "official" S3 support to the 2.0 branch. PL3 
will 
support S3 through django-storages.

Original comment by justin.d...@gmail.com on 23 Jul 2009 at 4:20

GoogleCodeExporter commented 9 years ago
Thanks for this great package, still the best in its category after all this 
time.

It works perfectly in a local environment, but I stumbled upon similar problems 
when I deployed to the staging server, with assets stored on Rackspace CDN.

For this purpose, I am using a Django storage called 
cumulus.storage.CloudFilesStorage

I get two different problems (as highlighted in this group):
self.image.path does not work properly because the image cannot be retrieved 
from the local machine. To solve this problem, I retrieve the image from their 
remote location with urllib and store them in a temporary local folder before 
processing them (e.g., when creating thumbnails)
im.save is not sufficient to store a picture (e.g., a newly created thumbnail), 
as it also has to be uploaded to CDN. To solve this problem, I call the 
function to upload the local temporary picture to the CDN
With these changes, Django Photologue works perfectly also with a remote 
storage such as Rackspace (using cumulus).

You can see the changes here: 
https://github.com/ff0000/django-photologue/commit/6942bb

With this post, I would like to know if you want me to create a 
(better-written) patch to supply this behavior to Django Photologue so that you 
can integrate it in the code.
Or else, if you already working on a new version of Photologue that deals with 
remote storage.

Congratulations once again for your code.

Original comment by claud...@gmail.com on 13 Mar 2011 at 7:49