KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Django's TEMPLATE_DIRS in Settings.py calls for unix style slashes. Because of this, when I call get_template('some/template.html') in a view, the result always starts at the root, and results in a call to /home/username/projectname/public/some/template.html The problem is that I'd like to use templates hosted on an entirely different site. This works fine for other Settings.py fields (MEDIA_URL and STATIC_URL), where it will take an absolute http path with no objection. Given an http path, TEMPLATE_DIRS ('http://example.com/',) in Settings.py will force get_template('some/template.html') in a view to try and find /home/username/projectname/public/http://example.com/some/template.html I've tried to circumvent this like so TEMPLATE_DIRS ('../../../../http://example.com/',) But it still forces a leading slash, so I get "/http://example.com", which is useless. My questions: Is there a way to trick this into pulling the template files from another server? Is that even feasible, given that the template files need to be processed for the view? Is it possible to create an alternate to 'django.template.loaders.filesystem.Loader' that doesn't call for unix style slashes?
Tags (comma-separated)
Save Edits
Cancel