Serve external template in Django

亡梦爱人 提交于 2019-12-25 02:32:49

问题


I want to do something like

return render_to_response("http://docs.google.com/View?id=bla", args)

and serve an external page with django arguments. Django doesn't like this (it looks for templates in very particular places).

What's the easiest way make this work? Right now I'm thinking to use urllib to save the page to somewhere locally on my server and then serve with the templates pointing to there.

Note: I'm not looking for anything particularly scalable here, I realize my proposal above is a little dirty.


回答1:


Read the template in as a string and render it yourself.



来源:https://stackoverflow.com/questions/3031056/serve-external-template-in-django

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!