zoukankan      html  css  js  c++  java
  • render,render_to_redponse,locals,redirect重定向

    #=============================================================
    #1.render进行页面渲染
    star='you are so beautiful'
    star2='handsome'
    # render_to_response需要引入
    # return render_to_response('test.html',{'name1':star,'name2':star2})
    #2.locals()
    #locals()可以将函数所有的变量传给前端(对效率有一定的影响)
    # return render_to_response('test.html',locals())
    # return render(req,'test.html',locals())
    #3.redirect()---------重定向
    # return redirect('http://www.baidu.com')
    #NETWORK中对应的状态码:302------重定向
    def login(req):
    if req.method=="POST":
    if 1:
    return redirect('http://www.baidu.com')

    return render(req, 'land.html')
    =============================================================

    
    
  • 相关阅读:
    喷水装置(一)
    下沙小面的(2)
    +-字符串
    非洲小孩
    寻找最大数(三)
    C
    寻找最大数
    阶乘之和
    背包问题
    python的内存管理机制(zz)
  • 原文地址:https://www.cnblogs.com/startl/p/12361166.html
Copyright © 2011-2022 走看看