Quantcast
Channel: Semi-Legitimate Feed
Viewing all articles
Browse latest Browse all 10

{{MEDIA_URL}} blank in Django Template

$
0
0

Are you trying to use the {{MEDIA_URL}} template tag and see it resolving as blank?

You have most likely omitted the third optional argument to your render_to_response call in your underlying view.

Your code is something like this:

 
from django.shortcuts import render_to_response
 
def awesomeView(request):
    return render_to_response('template.html', {})
 

It should be something like this:

 
from django.template import RequestContext
from django.shortcuts import render_to_response
 
def awesomeView(request):
    return render_to_response('template.html', {}, context_instance = RequestContext(request))
 

Author

Joel

Viewing all articles
Browse latest Browse all 10

Trending Articles