On Jan 12, 6:45 pm, Brian Neal <bgn...@gmail.com> wrote:
> On Jan 12, 4:58 pm, jazztpt <annacalla...@gmail.com> wrote:
> [...]
>
> > Brian, you understood me perfectly -- when I was asking about a tag, I
> > was simply asking if django used a shortcut the way rails does, and
> > {{MEDIA_URL}} is what I was looking for.  Duh.  :P
>
> > However, {{MEDIA_URL}} currently returns nothing.  I can't seem to
> > access any of my settings.py vars from my views; I get no errors but
> > no var either, it's just blank.  I've tried both relative and absolute
> > paths; my current code is this:
>
> [...]
>
> From the docs:
>
> "If TEMPLATE_CONTEXT_PROCESSORS contains this processor, every
> RequestContext will contain a variable MEDIA_URL, providing the value
> of the MEDIA_URL setting."
>
> So, does your TEMPLATE_CONTEXT_PROCESSORS in your settings.py file
> contain django.core.context_processors.media?
>
> Regards,
> BN

Sorry, posted too soon. Also, you have to send an instance of
RequestContext to your templates.

I quote from the docs again:

"
def some_view(request):
    # ...
    return render_to_response('my_template.html',
                              my_data_dictionary,
                              context_instance=RequestContext
(request))
"

So, 1) ensure your TEMPLATE_CONTEXT_PROCESSORS contains the media
processor, and then 2) pass a RequestContext to your templates.

Hope that helps,
BN
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to