模板不存在:500.html [英] Template does not exist: 500.html
本文介绍了模板不存在:500.html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经插入了我的模板 500.html
in:
- / project /
- / project / templates /
- /python2.5 /
- /python2.5/templates /
但是我总是得到这个错误:
TemplateDoesNotExist:500.html
我在HTTP 404错误中遇到同样的问题。
为什么?
解决方案
如果还没有,您可能需要在settings.py中指定模板目录。
例如在我的settings.py中,我有:
ROOTDIR = os.path.abspath(os.path.dirname(__ file__))
pre>
TEMPLATE_DIRS =(
#将字符串放在这里,如/ home / html / django_templates或C:/ www / django / templates
#始终使用正斜杠,即使在Windows
#不要忘记使用绝对路径,而不是相对路径
ROOTDIR +'/ logistics / templates',
)
I have created a template for the 500 HTTP error.
I have inserted my template
500.html
in:
- /project/
- /project/templates/
- /python2.5/
- /python2.5/templates/
but I always get this error:
TemplateDoesNotExist: 500.html
I get the same problem for an HTTP 404 error.
Why?
解决方案You might need to specify the template directories in settings.py, if you haven't already.
e.g. in my settings.py, I have:
ROOTDIR = os.path.abspath(os.path.dirname(__file__)) 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. ROOTDIR + '/logistics/templates', )
这篇关于模板不存在:500.html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文