我在templates / index.html
中有以下内容<!DOCTYPE html>
<html>
<head>
<title>Rango</title>
</head>
<body>
<h1>Rango says...</h1>
hello world! <strong>foo</strong><br />
<a href="/rango/about/">About</a><br />
</body>
但是,输出如下(页面源)
<Text Node: '<!DOCTYPE html>
<html>
'>
可能是什么原因?
编辑:
这是我的观看代码:
from django.shortcuts import render
from django.http import HttpResponse
from django.template import RequestContext, loader
# Create your views here.
def index(request):
template = loader.get_template('index.html')
return HttpResponse(template)