is it possible to get the value of MEDIA_URL from settings.py in the templates ?
Regards,
Dirk
--
"Feel free" – 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail
from django.conf import settings
...
return render_to_response("test.html", {'media_url':settings.MEDIA_URL})
--
I like python!
My Blog: http://www.donews.net/limodou
My Django Site: http://www.djangocn.org
NewEdit Maillist: http://groups.google.com/group/NewEdit
You can write a template context processor, and use the
`RequestContext` subclass of the normal Context.
See the official documentation (and list of built-in context processors) here:
http://www.djangoproject.com/documentation/templates_python/#subclassing-context-requestcontext
I've also written a tutorial which explains this in more detail, and
actually uses MEDIA_URL as the example:
http://www.b-list.org/weblog/2006/06/14/django-tips-template-context-processors
--
"May the forces of evil become confused on the way to your house."
-- George Carlin
thanks for the hints, that exactly what I was looking for.
May I'm not the first who asked this question.
The solution maybe should be placed somewhere on the django-wiki ?
Or the context_processor.media_url should go into the django-distro ?
Regards,
Dirk
--
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
Here's the context processor that I use in most of my projects:
http://www.verdjn.com/wiki/Siteroot
http://www.verdjn.com/browser/verdjnlib/context_processors/__init__.py