云驹博客

路漫漫其修远兮,吾将上下而求索。

0%

Django常用包

客户端请求服务端返回方式
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 重定向