Python Django 前後端資料互動 之 HttpResponse、render、redirect
阿新 • • 發佈:2018-12-28
在使用三神裝的時候,首先當然是得要匯入它們:
from django.shortcuts import HttpResponse, render, redirect
接受一個URL引數,表示讓瀏覽器跳轉去指定的URL.
例如:
def index(request):
# 業務邏輯程式碼
return redirect("https://blog.csdn.net/miaoqinian")