作者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
→ mail6543210:那是兩個引號",代表的是SGML中node(tag)body的trxt-n 05/29 02:33
→ mail6543210:text-node,也就是body的text 05/29 02:33
→ mail6543210:BTW,你的title怎麼跑到body去了??不是應該在head?? 05/29 02:34
→ Dream74:使用chrome 檢查元素title 會跑到 body 裡面 05/29 12:31
→ Dream74:但是在檢視 原始碼是正常的 不知道你是說這方面疑問嗎 05/29 12:32
→ Dream74:自己發現檔案本身有些問題,在utf8會看不到..所以解決了 05/30 02:34
→ Dream74:感謝各位幫忙 05/30 02:34