how can django tell where the search engine comes from and where the user comes from?
and
determine the user"s access device
how can django tell where the search engine comes from and where the user comes from?
and
determine the user"s access device
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;
}
I saved the user s login information in session, the django_ session table, but I found that every time a request is made, if the current session does not exist, the system automatically generates an empty session, like this: ] [1] [1] I saved the ab...
Field definition in model date_publish = models.IntegerField(verbose_name="" , default=0) how do I set the default current timestamp? ...
blog s article like function, like once + 1, use session to record the current user problem point is: if you like article 1, article 2 will indicate that it has been supported. The reason is to judge that session how to realize that articles cannot b...
Baidu said that there is a problem with the verification method in the file var lib pgsql 9.5 data pg_hba.conf, but the reason for changing the verification method is to use the command psql-U postgres-d mydjango-p 5432-h 127.0.0.1 to log in directl...
error configuring url while re-learning django configuration upload file from django.conf.urls import url from . import views from django.conf import settings from .upload import upload_image urlpatterns = [ -sharp url(r ^$ , views.index, name=...
in order to obtain Tencent Cloud s ssl certificate, enter the URL domain name after modifying the non-Wanwang domain name registered by Aliyun. the website cannot be accessed. Has anyone encountered ? nginx is normal: [root@iZwz9hbv3lrr68d8bo5dvp...
there is no problem with uploading small files on (iOS, Android) on mobile devices, but there are some larger files (more than 50m). After the upload progress is completed, it will take a long time for the server to return response information, and some...
when I install anaconda, on the server and run python, the prompt version number is 3.6.4 but when I use uwsgi, I report an error Internal Server Error I read the prompt,-no python application found, check your startup logs for errors- looked through...
this is the first small work that combines vue and django experiments. The problem occurs when the data is not available. Cannot be displayed in the thermal map. Please give me some advice. Thank you! this is a vue component with the following code: ...
formajax sendcodephone_numNoneurl ...
that s the question. I ve been looking for it on the Internet for a long time, but I can t find it. for example, I want to query SQL: select a from atable,btable where atable.id=btable.id an is the field of atable and b is the field of btable. B...
vue chromedriver@2.37.0 ...
at present, we are writing the api interface, which is the interface provided for the mobile end, so why do we add a token? when we set the user name and password for the user? And the document also says to verify it in the way of token? Isn t it okay t...
query the data in this way user_add1 = UserAddress.objects.filter(id=int(add_id)) then serialize json_data = serializers.serialize("json", user_add1, ensure_ascii=False) return json return HttpResponse(json.dumps(json_data), content_t...
as shown in the picture of the program, user.set_password ( data [ password ] ) also verifies that the output is True, but check to the database and find that the password has not changed. What is the reason? but if you do this in the database,...
as shown in the figure, a simple add and query operation takes up to 1 second [environment: windows + python3 + django2]. (the amount of data in PS: is not much, and todo_list has only 2 rows of data, which is still so slow.) def get(request): -...
wrote a blog, tags has to be loaded every page, so use template inheritance, inherited there is no data, is there any good way? I can think of a global variable or decorator. Does Django have a better solution? ...
"task1": "http: localhost:8000 api task1 ", "task2": "http: localhost:8000 api task2 ", "task3": "http: localhost:8000 api task3 ", requestapi? "big_job": "http: localhost:800...
For the project of django, direct command to run at 0.0.0.0 9090 is OK nginx reverse proxy is used to access static resources of 127.0.0.1purl 9090. my configuration is like this location { proxy_pass http: 127.0.0.1:9090;...
run this command root@VM-0-14-debian:~ webvue-sharp gunicorn-w 1 webvue.wsgi:application-b 127.0.0.1 webvue.wsgi:application 9090-t 30 as follows: [2018-04-02 17:56:58 +0000] [9374] [INFO] Starting gunicorn 19.7.1 [2018-04-02 17:56:58 +0000] [9374] [I...