Search code examples
djangotemplatesrenderer

Django render template from media folder


I'm trying to provide additional level of flexibility for some views, specifically, I want to be able to render a view using a django template from the media location (say referred to by a FileField, but it shouldn't matter).

What's the best way to approach this situation?


Solution

  • Add that directory to TEMPLATE_DIRS setting, and then use appropriate template name or path in view.

    Templates in django can reside anywhere on filesystem.