Diango book学习笔记三 HttpRequest对象URL

HttpRequest对象包含当前请求URL的一些信息: spa

属性/方法 说明 举例
request.path 除域名之外的请求路径,以正斜杠开头 "/hello/"
request.get_host() 主机名(好比,一般所说的域名) "127.0.0.1:8000" or "www.example.com"
request.get_full_path() 请求路径,可能包含查询字符串 "/hello/?print=true"
request.is_secure() 若是经过HTTPS访问,则此方法返回True, 不然返回False True 或者 False
相关文章
相关标签/搜索