django 变量交给前台模板

<html>
<head>
<title>Ordering notice</title>
</head>
<body>
<h1>Ordering notice</h1>
<p>Dear {{ aaa }},</p>
<p>Dear {{ bbb }},</p>


def notice(req):
   #return render_to_response('polls/notice.html')
   #    return render(request, 'cmdb/year_archive.html', {
   #     'foo': aaaa,
   # })
   return render(req,'polls/notice.html',{'aaa':'111','bbb':'222'})

原文地址:https://www.cnblogs.com/hzcya1995/p/13349274.html