request.get_full_path() 和request.path区别

1. 都是获取request 请求的url路径

2. request.get_full_path() -- 获取当前url,(包含参数)

     请求一个http://127.0.0.1:8000/200/?type=10

      request.get_full_path()返回的是【/200/?type=10】

     request.path --  获取当前url,(但不含参数)

      request.path返回的是 【/200/】

3. 如果想让其正常显示(有中文的情况下),需进行如下编码处理【django 默认编码是unicode 的】

   

request.get_full_path().encode('utf-8')  
request.path.encode('utf-8') 
 
原文地址:https://www.cnblogs.com/robinunix/p/9182482.html