STATIC_URL undefined in base Django template STATIC_URL undefined in base Django template django django

STATIC_URL undefined in base Django template


Perhaps this can help:

If {{ STATIC_URL }} isn't working in your template, you're probably not using RequestContext when rendering the template.As a brief refresher, context processors add variables into the contexts of every template. However, context processors require that you use RequestContext when rendering templates. This happens automatically if you're using a generic view, but in views written by hand you'll need to explicitly use RequestContext To see how that works, and to read more details, check out Subclassing Context: RequestContext.


You need to add 'django.core.context_processors.static' to your TEMPLATE_CONTEXT_PROCESSORS variable in settings.py.


You need to add 'django.core.context_processors.request' to your TEMPLATE_CONTEXT_PROCESSORS.