Re: proper way to use S3Storage and Django ImageField

2009-01-19 Thread Aaron Lee
Yes avatar.image.url works, thanks again. -Aaron On Mon, Jan 19, 2009 at 5:17 PM, creecode wrote: > > I think you may be correct on that my tip was incorrect. Forget what > I said! :-) > > Have you tried getting the url like avatar.image.url? I use a line > like this in

Re: proper way to use S3Storage and Django ImageField

2009-01-19 Thread creecode
I think you may be correct on that my tip was incorrect. Forget what I said! :-) Have you tried getting the url like avatar.image.url? I use a line like this in some of my code that uses S3Storage and it works. image_url = my_model_instance.image.url.replace ( ':80', '' ) On Jan 19, 4:01 pm,

Re: proper way to use S3Storage and Django ImageField

2009-01-19 Thread David Larlet
Le 20 janv. 09 à 01:48, Aaron Lee a écrit : > Thanks David, but it seems awkward to call > > avatar.image.storage.url(str(avatar.image)) > > to retrieve the URL for an ImageField. > Do you have a better way? avatar.image.url should work (without parenthesis, that's a property). I propose to

Re: proper way to use S3Storage and Django ImageField

2009-01-19 Thread Aaron Lee
Thanks David, but it seems awkward to call avatar.image.storage.url(str(avatar.image)) to retrieve the URL for an ImageField. Do you have a better way? -Aaron On Mon, Jan 19, 2009 at 4:02 PM, David Larlet wrote: > > > Le 19 janv. 09 à 22:53, Aaron Lee a écrit : > > > > But

Re: proper way to use S3Storage and Django ImageField

2009-01-19 Thread David Larlet
Le 19 janv. 09 à 22:53, Aaron Lee a écrit : > > But I am still getting the exception saying the backend doesn't > support absolute paths. > In django/db/models/fields/files.py line 52 _get_path > return self.storage.path(self.name) > > and my self.name is userprofile/cs1.jpg > > Any

Re: proper way to use S3Storage and Django ImageField

2009-01-19 Thread creecode
Hey Aaron, I think part of your problem is that AWS_STORAGE_BUCKET_NAME is not properly specified. It think it needs to be something like my-bucket- name.s3.amazonaws.com. Based on your settings then you should find your images end up at http:my-bucket-name.s3.amazonaws.com/ userprofile/. You

Re: proper way to use S3Storage and Django ImageField

2009-01-19 Thread Aaron Lee
Yes and yes, here are my settings in settings.py # Storage Settings DEFAULT_FILE_STORAGE = 'libs.storages.S3Storage.S3Storage' AWS_ACCESS_KEY_ID='xxx' AWS_SECRET_ACCESS_KEY='xxx' AWS_STORAGE_BUCKET_NAME='userprofile' from S3 import CallingFormat AWS_CALLING_FORMAT=CallingFormat.SUBDOMAIN

Re: proper way to use S3Storage and Django ImageField

2009-01-19 Thread Merrick
I am using S3Storage with an imagefield successfully. It sounds like you have not specified the storage engine and keys etc... in settings.py as creecode pointed out. I recall testing that the directory will be created on the fly if it does not exist. On Jan 19, 12:40 pm, creecode

Re: proper way to use S3Storage and Django ImageField

2009-01-19 Thread creecode
Hello Aaron, I can confirm that it can work. I'm using it but I don't know enough to diagnose your problem. Have you created the userprofile "directory" in your S3 bucket? Have you added the following to your settings.py? DEFAULT_FILE_STORAGE = 'S3Storage.S3Storage' AWS_ACCESS_KEY_ID

Re: proper way to use S3Storage and Django ImageField

2009-01-19 Thread Aaron Lee
So I guess S3Storage doesn't work with ImageField? Can anyone confirm that? -Aaron On Thu, Jan 15, 2009 at 10:30 AM, Aaron wrote: > > ping? > > On Jan 12, 9:53 am, "Aaron Lee" wrote: > > Hi all and David, > > > > I followed

Re: proper way to use S3Storage and Django ImageField

2009-01-15 Thread Aaron
ping? On Jan 12, 9:53 am, "Aaron Lee" wrote: > Hi all and David, > > I followed thehttp://code.larlet.fr/doc/django-s3-storage.html > installation and created a simple model > > class Avatar(models.Model): >     """ >     Avatar model >     """ >     image =

proper way to use S3Storage and Django ImageField

2009-01-12 Thread Aaron Lee
Hi all and David, I followed the http://code.larlet.fr/doc/django-s3-storage.html installation and created a simple model class Avatar(models.Model): """ Avatar model """ image = models.ImageField(upload_to="userprofile") user = models.ForeignKey(User) By using the