Is anyone out there using S3FileField (http://code.djangoproject.com/
wiki/AmazonSimpleStorageService) in their models to interface with
Amazon's S3 service?

I've saved the code from the above url into a file 'amazon_s3.py' in
my project directory (e.g. <my_project>/amazon_s3.py) and I've saved
the Amazon code from 
http://developer.amazonwebservices.com/connect/entry.jspa?externalID=134&categoryID=47
into <my_project>/amazon/. I've set the DEFAULT_BUCKET value in my
settings file but I'm trying to figure out how to set the key for the
S3FileField. There is a method called 'set_key' which apparently does
this, but I don't know how to set this value in my model.
My model currently looks something like this (and validates, so all
the import statements seem to be in working order):

from django.db import models
from my_project.amazon_s3 import S3FileField
class Photo(models.Model):
    photo_file = S3FileField()

I would like to be able to set the key so that each file would be
accessible from a url like 
http://s3.amazonaws.com/<DEFAULT_BUCKET>/media/img/photo.jpg,
that is, I want to set the key to "/media/img/" + file_name

I have another question about the code from the wiki page. There is a
keyword argument 'upload_to="s3"':

class S3FileField(models.FileField):
    def __init__(self, verbose_name=None, name=None, bucket='',
is_image=False, **kwargs):
        models.FileField.__init__(self, verbose_name, name,
upload_to="s3", **kwargs)

What does the value assigned to upload_to mean in the context of S3
storage?

Any tips appreciated.

Cheers,
John-Scott


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to