标签:temp create def code print views ons loading mic
一、创建模版
二、代码实现
from django.shortcuts import render from django.template import loader from django.http import HttpResponse # Create your views here. def app_three(request): # 加载获取模版 index = loader.get_template(‘three.html‘) content = { ‘name‘:‘mozili‘ } # 渲染模版,变成html result = index.render(context=content) print(result) return HttpResponse(result)
三、启动服务,访问
python3 manage.py runserver
标签:temp create def code print views ons loading mic
原文地址:https://www.cnblogs.com/lxmtx/p/13277494.html