wsgi
  • gunicorn
  • 2011-10-27 39 views 0 likes 
    0

    我運行下面的代碼從gunicorn的網站稍微modfied(http://gunicorn.org/run.htmlhttp請求裏面的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錯誤和索賠提出請求「未收到日期」

    任何想法發生了什麼?我還沒有發現任何與網絡上其他地方有關的任何東西。

    謝謝!

    回答

    0

    我想通這一個看這裏: https://github.com/benoitc/gunicorn/issues/38

    它向我指出這個記錄的缺陷中的urllib2在OS X - https://trac.macports.org/ticket/24421

    我設法使用Python 2.6.6,而不是修復它的Python 2.6.5 - 很確定我安裝了不同的以及也可能是修復。另一個建議的修補程序是將python降級到2.6.4

    相關問題