Custom base_site.html not working in Django

五迷三道 提交于 2019-12-07 03:03:51

问题


I am using Nitrous for playing with the Django framework. In tutorial 2 is shown how to change the base_site.html template. I've added in the TEMPLATE_DIRS = ( ) a new line:

'home/action/workspace/mysite/templates',

And in base_site.html I changed the site name title of Django Administration into Administration:

{% trans 'Administration' %}

But I still see no changes on the website. I've tried different TEMPLATE_DIRS like:

'~/workspace/mysite/templates',

'home/action/workspace/mysite/',

'home/action/workspace/mysite/templates/',

And restarting the server. But I am doing something wrong.


回答1:


Note that this answer was written before the TEMPLATES setting was introduced in Django 1.8.

The tutorial says you should create an admin subdirectory inside your template directory, and put your template inside that.

Try with base_site.html in /home/action/workspace/mysite/templates/admin and with

TEMPLATE_DIRS = (
    '/home/action/workspace/mysite/templates',
)

Note the slash before /home/... and the trailing comma to make it a tuple.



来源:https://stackoverflow.com/questions/17796816/custom-base-site-html-not-working-in-django

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