I'm trying to set up a MEDIA_ROOT however when I set this in my settings.py it doesn't seem to be recognized. For example my settings.py looks like:
...
MEDIA_ROOT = '/static/files/'
...
And in a template (to test this change) - I tried:
Media root: {{ MEDIA_ROOT }}
static url: {{STATIC_URL }}
static url displays fine and i can update and change it and those changes are reflected in the test template. However media root is always an empty string. Is there some additional config required to start using MEDIA_ROOT - can someone point me to documentation if so?
There are two context variables which should be available to you by default (as long as you use a RequestContext instance when rendering your template:
MEDIA_URL
-- provided bydjango.core.context_processors.media
STATIC_URL
-- provided bydjango.code.context_processors.static
Both of those context processors are in the default list, as you can see at https://docs.djangoproject.com/en/1.3/ref/settings/#template-context-processors
MEDIA_ROOT
is supposed to be a filesystem path, and is used for loading and saving media on disk. There shouldn't be any reason to use it in a template. IF you really need access to it, it is simple enough to write your own context processor to provide it.The documentation on the media processor, btw, is at https://docs.djangoproject.com/en/1.3/ref/templates/api/#django-core-context-processors-media