程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Strange phenomenon that Django URL name cannot be called Ping

編輯:Python

Abstract : In use Django When developing interfaces , I wrote a book called ping The interface of , It's been debugging all day 404 It's confusing you , Later, I found that if you change the interface name to something else , In the following eyes chrome Intermediate interface name ping That's what happened .

 

Strange phenomena recur

Defining interfaces ping Use Chrome Automatic replenishment upon request ping/ Cause request 404. use drf_ysag

The code of the strange problem is as follows

Use chrome Use in drf_yasg The response to the direct request is as follows , In the right figure, you can see that the server is the recognized request ping/

Use Chrome Browser request , We can see it, too URL There is ping The item , Notice that the detail is a slash after the request . Although or requested is ping, The server redirects it to ping.

 

Subsequent experimental findings Use Edge There would be no such strange phenomenon .

 

Tried out solutions

Now that you find out Chrome Browser automatically ping become ping/ That handle url It's written in ping/  After this change Whether it's chrome still edge All requests can be made Normal response

Change your name

I put ping Switch to qing Also register routes in the same way as before

  then chrome Normal response It doesn't automatically become qing/; It's crazy I've been tossing around for two days !!!

 


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved