import os
from django.template import RequestContext
from django.conf import settings
from django.shortcuts import render_to_response
def view(request):
media_files = [ f for f in listdir(settings.MEDIA_ROOT) if isfile(join(settings.MEDIA_ROOT,f)) ]
...
return render_to_responce('media_index.html',{'files':media_files},context_instance=RequestContext(request))