[問題] Django extends

看板Python作者 (Dream惎)時間12年前 (2012/05/28 19:28), 編輯推噓0(008)
留言8則, 2人參與, 最新討論串1/1
請教各位 我使用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

05/29 02:33, , 1F
那是兩個引號",代表的是SGML中node(tag)body的trxt-n
05/29 02:33, 1F

05/29 02:33, , 2F
text-node,也就是body的text
05/29 02:33, 2F

05/29 02:34, , 3F
BTW,你的title怎麼跑到body去了??不是應該在head??
05/29 02:34, 3F

05/29 12:31, , 4F
使用chrome 檢查元素title 會跑到 body 裡面
05/29 12:31, 4F

05/29 12:32, , 5F
但是在檢視 原始碼是正常的 不知道你是說這方面疑問嗎
05/29 12:32, 5F

05/29 12:39, , 6F
網址: http://ppt.cc/je,p 可能我描述不清楚附上網址
05/29 12:39, 6F

05/30 02:34, , 7F
自己發現檔案本身有些問題,在utf8會看不到..所以解決了
05/30 02:34, 7F

05/30 02:34, , 8F
感謝各位幫忙
05/30 02:34, 8F
文章代碼(AID): #1Fms5gQv (Python)