Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要加载一些路径取决于它们的上下文的模板。我创建了一个自定义Loader。如何从我的自定义模板加载器访问模板的上下文?
你能举例说明你有什么样的项目结构吗?
是吗:
myproject/ myapps1/templates/myapp_template
还是常规:
myproject/ myapps1 templates/myapps1/myapp_template
问的原因是很多问题可以通过模板标签解决,url.py还有项目结构。
url.py
在第一种类型中,您可能需要自定义加载程序。在第二个中,模板标签和myapps1/urls.py将做的伎俩。
myapps1/urls.py