0
我運行下面的代碼從gunicorn的網站稍微modfied(http://gunicorn.org/run.html)http請求裏面的gunicorn導致gunicorn響應失敗?
import urllib2
def app(environ, start_response):
print "in app"
# response=urllib2.urlopen('http://www.google.com')
data = 'Hello, World!\n'
response_headers = [
('Content-type','text/plain'),
('Content-Length', str(len(data)))
]
start_response('200 OK', response_headers)
print " starting response"
return iter([data])
它完全按預期運行除非我取消了urrllib2.urlopen線,整個代碼就會失敗。
我正在運行gunicorn,沒有指定conf文件,這意味着錯誤應該寫入stdout(沒有任何)。瀏覽器向gunicorn錯誤和索賠提出請求「未收到日期」
任何想法發生了什麼?我還沒有發現任何與網絡上其他地方有關的任何東西。
謝謝!