Le 22 oct. 2012 à 15:13, Dae_James a écrit :
> I use ImageField(with upload_to = 'photos') to receive user-uploaded images.
> And in my template, I want to use (image
> is the object of ImageField) to display them. However, images can't be
> displayed. I think it's not
I use *ImageField*(with upload_to = 'photos') to receive user-uploaded
images. And in my template, I want to use **(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.
Serve the image as a static file. in your settings.py file set the
following:
STATIC_URL = '/static/'
STATICFILES_DIRS = ('/path/to/your/image/directory',) # Without a trailing
slash
and then load your image as
On Mon, Oct 22, 2012 at 5:14 PM, Joel Goldstick wrote:
On Mon, Oct 22, 2012 at 6:00 AM, Dae James wrote:
> The returned html code by my app is :
> The "image.jpg" file is in "project_dir/photos/" directory. PS: project_dir
> is my django project's root directory.
>
> So why the image could not be loaded. Please help~
> Thank you~
>
The returned html code by my app is :
The "image.jpg" file is in "project_dir/photos/" directory. PS: project_dir is
my django project's root directory.
So why the image could not be loaded. Please help~
Thank you~
Dae James
--
You received this message because you are subscribed to the
5 matches
Mail list logo