我正在使用django开发一个网站。我需要从重定向响应中获取url(位置),但找不到任何方法或attr。
Traceback (most recent call last):
File "/opt/python27/lib/python2.7/site-packages/django/core/handlers/base.py", line 223, in get_response
response = middleware_method(request, response)
File "/opt/dbinabox/DBInBoxWeb/dbinabox/dbasrm/altus.py", line 16, in process_response
print response.header
AttributeError: 'HttpResponseRedirect' object has no attribute 'header'
试试response.url
。来自docs:
此只读属性表示响应将重定向到的URL(相当于位置响应标头)。