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 <img src="/static/image.jpg" />
On Mon, Oct 22, 2012 at 5:14 PM, Joel Goldstick <[email protected]>wrote:
> On Mon, Oct 22, 2012 at 6:00 AM, Dae James <[email protected]> wrote:
> > The returned html code by my app is : <img src="photos/image.jpg" />
> > 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~
> >
> Because your image is not in the directory that your html file shows.
> Go to the django documentation and try to understand static files.
>
> > ________________________________
> > Dae James
>
> --
> Joel Goldstick
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to [email protected].
> 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.
>
>
--
Thanks & Regards
----------------------------
Amyth [Admin - Techstricks]
Email - [email protected], [email protected]
Twitter - @mytharora
http://techstricks.com/
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
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.