How do I load a django template using absolute paths? [duplicate]

I have a template xyz.html stored in the path /doc-templates/ so the full path is /doc-templates/xyz.html

I'm trying to load the template using

my_template = get_template('/doc-templates/xyz.html')

But this raises the TemplateDoesNotExist exception. Any ideas before I roll out my own template loader? PS: Yes I know where Django templates should be, I just want to see if this is possible now that everything is being "dockerized"

I have explicitly enabled django.template.loaders.filesystem.Loader and set the DIRS to a non empty list as documented but it seems to be ignoring the absolute path (possibly appending it to the DIRS list)

Back to Top