1 2 3 4 5 6
| from django.shortcuts import render, HttpResponse, redirect
def index(request): # return render(request, 'index.html', {data: data}) # render 读取html模板(服务端渲染) # return HttpResponse('Hello wrold!') # 返回字符串(接口) return redirect('https://www.baidu.com') # redirect 重定向
|