Django 1.10 Apache2 mod_wsgi IOError:无法写入数据

时间:2017-01-05 23:37:38

标签: python django apache2 wget mod-wsgi

我有一个django网站

  • django version 1.10.5
  • djangorestframework == 3.5.3

此网站托管按组件隔离的文件,供用户下载。

从昨天开始,我看到了以下问题。对于几个组件,我们可以说' a'和' b',我无法将文件下载到Linux机器上。对于其他组件,我可以下载文件。

我说linux的原因是因为..我将相同的文件下载到我的macbook中,我可以毫无问题地下载。

在Linux机器上,我看到以下错误:

wget

在服务器端(最初运行django开发服务器,现在替换为mod_wsgi和apache2 ):

curl

我认为这是客户的问题。但我在httpieimport os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETTINGS_MODULE", "DevServe.settings") application = get_wsgi_application() AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.17 mod_wsgi/3.4 Python/2.7.6 configured

中看到了同样的问题

我已经使用python / Django / wsgi / apache2扫描了google返回此类错误的所有相关内容,但无法找到有用的内容。

此外,这里是django生成的wsgi.py我正在使用这个网站。

root@xyz:/tmp/test# curl -vv -O http://x.x.x.x:8000/releases/media/releases/2017_01_05/xyz
*   Trying x.x.x.x...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to x.x.x.x (x.x.x.x) port 8000 (#0)
> GET /releases/media/releases/2017_01_05/xyz HTTP/1.1
> Host: x.x.x.x:8000
> User-Agent: curl/7.47.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< Date: Fri, 06 Jan 2017 22:32:01 GMT
< Server: Apache/2.4.7 (Ubuntu)
< X-Frame-Options: SAMEORIGIN
< Last-Modified: Fri, 06 Jan 2017 00:38:02 GMT
< Content-Length: 15430268
< Content-Type: application/octet-stream
< 
{ [1166 bytes data]
 46 14.7M   46 6983k    0     0  5624k      0  0:00:02  0:00:01  0:00:01 5622k* Recv failure: Connection reset by peer
 79 14.7M   79 11.7M    0     0  5587k      0  0:00:02  0:00:02 --:--:-- 5590k
* Closing connection 0
curl: (56) Recv failure: Connection reset by peer

root@xyz:/tmp/test# curl -vv -O http://x.x.x.x:8000/releases/media/releases/2016_10_31/abc
*   Trying x.x.x.x...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to x.x.x.x (x.x.x.x) port 8000 (#0)
> GET /releases/media/releases/2016_10_31/abc HTTP/1.1
> Host: x.x.x.x:8000
> User-Agent: curl/7.47.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< Date: Fri, 06 Jan 2017 22:32:31 GMT
< Server: Apache/2.4.7 (Ubuntu)
< X-Frame-Options: SAMEORIGIN
< Last-Modified: Mon, 31 Oct 2016 23:17:24 GMT
< Content-Length: 108747612
< Content-Type: application/octet-stream
< 
{ [1165 bytes data]
100  103M  100  103M    0     0  4158k      0  0:00:25  0:00:25 --:--:-- 4275k
* Connection #0 to host x.x.x.x left intact

知道问题可能是什么?

提前致谢。

更新:

Python,apache和mod_wsgi版本:

pip freeze | grep wsgi
mod-wsgi==4.5.13

工作文件下载和文件下载失败的卷曲详细输出。第一个是下载失败,第二个是成功下载。

[Mon Jan 09 12:05:54.582945 2017] [mpm_prefork:notice] [pid 29510] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.17 mod_wsgi/4.5.13 Python/2.7 configured -- resuming normal operations
[Mon Jan 09 12:05:54.583000 2017] [core:notice] [pid 29510] AH00094: Command line: '/usr/sbin/apache2'
[Mon Jan 09 12:06:51.974442 2017] [wsgi:error] [pid 29514] [remote 10.11.50.97:41884] mod_wsgi (pid=29514): Exception occurred processing WSGI script '/var/www/xyz/wsgi.py'.
[Mon Jan 09 12:06:51.974633 2017] [wsgi:error] [pid 29514] [remote 10.11.50.97:41884] IOError: Apache/mod_wsgi failed to write response data: Broken pipe.
[Mon Jan 09 12:06:54.086790 2017] [wsgi:error] [pid 29514] [remote 10.11.50.97:41886] mod_wsgi (pid=29514): Exception occurred processing WSGI script '/var/www/xyz/wsgi.py'.
[Mon Jan 09 12:06:54.086944 2017] [wsgi:error] [pid 29514] [remote 10.11.50.97:41886] IOError: Apache/mod_wsgi failed to write response data: Broken pipe.

mod_wsgi版本和安装 我有可以通过pip得到的最新版本

<form id="auth_form" action="action.php" method="post">

  <div class="form-group has-feedback" name="auth_code" id="auth_code">
    <label for="auth_code" class="control-label">Authorisation Code</label>
    <input class="form-control" id="auth_code_input" name="auth_code_input" type="password">
    <span class="form-control-feedback glyphicon"></span>
  </div>

  <div class="form-group">
    <div>
      <button class="btn btn-info" name="submit" type="submit">Submit</button>
    </div>
  </div>

</form>

更新最新的mod_wsgi版本后,我仍然看到同样的问题

 $(document).ready(function() {

   $('#auth_form').on('submit', function(e) {
     var auth_code = $('#auth_code_input');

     if (!auth_code.val()) {
       auth_code.closest('.form-group').addClass('has-error');
       auth_code.closest('.form-control-feedback').addClass('glyphicon-remove');
       e.preventDefault();
     } else {
       auth_code.closest('.form-group').removeClass('has-error').addClass('has-success');
       auth_code.closest('.form-control-feedback').addClass('glyphicon-ok');
     }
   });

 });

0 个答案:

没有答案