http://docs.djangoproject.com/en/dev/howto/static-files/
This suggests that I can use STATIC_URL in my template to get the value from settings.py.
Template looks like this:
<link href="{{STATIC_URL}}stylesheets/tabs.css" rel="stylesheet" type="text/css" media="screen" />
Settings.py looks like this:
STATIC_ROOT = ''
STATIC_URL = '/static/'
When I go to the page I just get <link href="stylesheets/tabs.css" i.e. no STATIC_URL.
What am I missing?
You have to use
context_instance=RequestContext(request)in yourrender_to_response, for example:Or use the new shortcut render
As Dave pointed out, you should check if
django.core.context_processors.staticis in yourTEMPLATE_CONTEXT_PROCESSORSvariable in settings.py. As the docs said, it`s there by default.