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
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,
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
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
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
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
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
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
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
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
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 =
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
12 matches
Mail list logo