Monday, October 22, 2012

Re: My page cound not load image, help!


Le 22 oct. 2012 à 15:13, Dae_James <daedae11@126.com> a écrit :

I use ImageField(with upload_to = 'photos') to receive user-uploaded images. And in my template, I want to use <img src="{{ object.image.url }}" />(image is the object of ImageField) to display them. However, images can't be displayed. I think it's not about static files. If it is, what's the use of ImageField's url property.

Moreover, images will relate to the MEDIA_*

Static are really meant to be static, ie they won't change as long as you don't update your project/applications.
Media are where other files should go. Whether they are uploaded user documents or application generated ones, they should go there.

For moreinformation have a look there:
And especially the part after: "Using a FileField or an ImageField (see below) in a model takes a few steps:"

Regards,
Xavier Ordoquy,
Linovia.

No comments:

Post a Comment