源代码路径
Libsite-packagesdjangohttprequest.py
获取带参数 URL
( django 1.11 居然报错了)
request.get_full_path()
print(request.get_full_path()) ^ SyntaxError: invalid character in identifier
获取路劲不带 host 和 port
request.path
获取请求地址
request.get_host()
获取绝对地址
request.get_raw_uri()
例子
代码语言:javascript复制# 输入
print(request.get_host())
print(request.get_raw_uri())
print(request.path)
# 输出
# 192.168.3.246:10000
# http://192.168.3.246:10000/photos/ablum/3/
# /photos/ablum/3/