标签:
views.py中编写相关代码
from django.http import HttpResponse
from django.template import loader,Context
def index(req):
#生成模板对象
t=loader.get_template("index.html")
#生成Context对象
context = Context({})
return HttpResponse(t.render(context));
from django.shortcuts import render_to_responsedef index(req):
return render_to_response("index.html",{"title":"hello world","name":"JohnRey"})
标签:
原文地址:http://www.cnblogs.com/Yellow0-0River/p/5425161.html