作者Dream74 (Dream惎)
看板Python
标题[问题] Django extends
时间Mon May 28 19:28:39 2012
请教各位 我使用django 1.4a1 版本 ubuntu 11.10
呼叫流程 index.html extends test.html,而在test.html extends base.html,
而我呼叫 index.html时,大致上是正常,
但是在chrome与 firefox <body>与<title>之间会跑出不知道是什麽(好像脏脏的东西),
不知道发生什麽事情?
chrome 检查元素:
<html><head>(略..)</head>
<body>?<title>test</title></body></html>
图:
http://ppt.cc/sY28
档案:
http://ppt.cc/-3P;
url.py :
from django.conf.urls.defaults import patterns, include, url
urlpatterns = patterns('test.views',
(r'^$', 'index'),
)
views.py:
from django.shortcuts import render_to_response
def index(request):
return render_to_response('index.html')
{ TEMPLATE_DIRS path }/index.html:
{% extends "showcode/test.html"%}
档案:
http://ppt.cc/vJYt
{ TEMPLATE_DIRS path }/test.html:
{% extends "base.html" %}
档案:
http://ppt.cc/BF06
{ TEMPLATE_DIRS path }/base.html:
<html><title>test</title></html>
档案:
http://ppt.cc/A;X3
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.135.10.166
1F:→ mail6543210:那是两个引号",代表的是SGML中node(tag)body的trxt-n 05/29 02:33
2F:→ mail6543210:text-node,也就是body的text 05/29 02:33
3F:→ mail6543210:BTW,你的title怎麽跑到body去了??不是应该在head?? 05/29 02:34
4F:→ Dream74:使用chrome 检查元素title 会跑到 body 里面 05/29 12:31
5F:→ Dream74:但是在检视 原始码是正常的 不知道你是说这方面疑问吗 05/29 12:32
7F:→ Dream74:自己发现档案本身有些问题,在utf8会看不到..所以解决了 05/30 02:34
8F:→ Dream74:感谢各位帮忙 05/30 02:34