Re: couldn't render a media image via a template
Thank you very much.
I think the problem is about printing variable. {{ MEDIA_URL }} doesn't print anything in the template. For now, I solved the problem by using absolute path, /media/... .
--
On Sunday, April 7, 2013 9:20:16 AM UTC+3, psjinx wrote:
On Sat, Apr 6, 2013 at 4:11 PM, Fatih Tiryakioglu <fati...@gmail.com> wrote:--
> MEDIA_ROOT = '/home/mehmet/internet_projeleri/site4ust/site4/ media'
This is the absolute path to your media directory.
> MEDIA_URL = '/media/'
This means files/directories at MEDIA_ROOT directory will be
accessible at an url starting with /media/. For example,
/home/mehmet/internet_projeleri/site4ust/site4/ media/hello.jpg can be
viewed at /media/hello.jpg
> STATIC_ROOT = ' '
This should be set to absolute path of your static directory. `python
manage.py collectstatic` command collects static files from different
apps in this directory.
> STATIC_URL = '/unnamed/'
As explained above for MEDIA_URL
If you want to use an image located at
/home/mehmet/internet_projeleri/site4ust/unnamed/ 60830071673353216.jpg
then change
MEDIA_ROOT="/home/mehmet/internet_projeleri/site4ust/ unnamed"
MEDIA_URL="/media/"
> <img src="{{ MEDIA_URL }}/60830071673353216.jpg" />
Above code will work now.
--
Sincerely,
Pankaj Singh
http://about.me/psjinx
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home