【发布时间】:2013-06-05 13:46:55
【问题描述】:
我已经尝试了link 的说明,将默认应用模板替换为我网站的特定模板。
具体来说,我设置了以下文件结构:
project_specific_app
-templates
--userena
---files_with_same_names_as_userena_templates.html
TEMPLATE_DIRS:
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
但是,当我尝试更改“files_with_same_name_as_userena_templates.html”的内容并重新启动网络服务器时,网页并没有改变
我还忘记了什么?
解决方案:在我的 project/settings.py 中查看 TEMPLATE_DIRS 并将其更改为 /absolute/path/to/project/specific/app/templates/ 我的自定义模板有效。
【问题讨论】:
-
settings.py中的TEMPLATE_DIRS变量看起来如何? -
TEMPLATE_DIRS = ( # 将字符串放在这里,例如 "/home/html/django_templates" 或 "C:/www/django/templates"。# 始终使用正斜杠,即使在 Windows 上也是如此。# Don'不要忘记使用绝对路径,而不是相对路径。)
-
您不应在问题中发布答案。你宁愿接受给出的答案。
标签: python django web django-templates