【发布时间】:2010-10-24 10:32:34
【问题描述】:
是否可以通过python cgi脚本发送200以外的状态码(如301重定向)
【问题讨论】:
是否可以通过python cgi脚本发送200以外的状态码(如301重定向)
【问题讨论】:
通过 cgi 脚本?
print "Status:301\nLocation: http://www.google.com"
【讨论】:
通过 wsgi 应用程序?
def simple_app(environ, start_response):
status = '301 Moved Permanently' # HTTP Status
headers = [('Location','http://example.com')] # HTTP Headers
start_response(status, headers)
return []
【讨论】: