How does django judge where the search engine comes from and where the user comes from?

how can django tell where the search engine comes from and where the user comes from?

and

determine the user"s access device

Apr.09,2021

has not used django. Provide an idea

can be obtained with js. Then pass it to python

var refer=document.referrer;
//var sosuo=refer.split(".")[1];
var sosuo = domainURI(refer);
var grep=null;
var str=null;
var keyword=null;
var wd = '';
switch(sosuo){
    case "www.baidu.com":
        grep = /wd\=.*\&/i;
        str=refer.match(grep);
        keyword=str.toString().split("=")[1].split("&")[0];
        wd =decodeURIComponent(keyword);
      break;
    case "m.baidu.com":
        grep = /word\=.*\&/i;
        str=refer.match(grep);
        keyword=str.toString().split("=")[1].split("&")[0];
        wd =decodeURIComponent(keyword);
      break;
    case "image.baidu.com":
        grep = /word\=.*\&/i;
        str=refer.match(grep);
        keyword=str.toString().split("=")[1].split("&")[0];
        wd =decodeURIComponent(keyword);
      break;
    case "www.sogou.com":
        grep = /&query\=.*/i;
        str=refer.match(grep);
        keyword=str.toString().split("&")[1].split("=")[1];
        wd =decodeURIComponent(keyword);
      break;
    case "m.sogou.com":
        grep = /&keyword\=.*/i;
        str=refer.match(grep);
        keyword=str.toString().split("&")[1].split("=")[1];
        wd =decodeURIComponent(keyword);
      break;
    case "www.haosou.com":
        grep = /q\=.*/i;
        str=refer.match(grep);
        keyword=str.toString().split("=")[1].split("&")[0];
        wd =decodeURIComponent(keyword);
      break;
    case "m.haosou.com":
        grep = /q\=.*/i;
        str=refer.match(grep);
        keyword=str.toString().split("=")[1].split("&")[0];
        wd =decodeURIComponent(keyword);
      break;
    case "image.haosou.com":
        grep = /q\=.*/i;
        str=refer.match(grep);
        keyword=str.toString().split("=")[1].split("&")[0];
        wd =decodeURIComponent(keyword);
      break;
}
if(sosuo.indexOf("sm.cn")>=0 && wd ==''){
    grep = /q\=.*/i;
    str=refer.match(grep);
    keyword=str.toString().split("=")[1].split("&")[0];
    wd =decodeURIComponent(keyword);
}
else if(sosuo.indexOf("so.com")>=0 && wd ==''){
    grep = /q\=.*/i;
    str=refer.match(grep);
    keyword=str.toString().split("=")[1].split("&")[0];
    wd =decodeURIComponent(keyword);
}
else if(sosuo.indexOf("sogou.com")>=0 && wd ==''){
    grep = /&keyword\=.*/i;
    str=refer.match(grep);
    keyword=str.toString().split("&")[1].split("=")[1];
    wd =decodeURIComponent(keyword);
}
function domainURI(str){
    var result = '';
    if(str!='' && str != null){
        var durl=/(https|http):\/\/([^\/]+)\//i;  
        domain = str.match(durl);
        result = domain[2];
    }
    return result;
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3d176-2c37e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3d176-2c37e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?