python - 处理来自 IOS 设备的请求时发生异常

标签 python ios django sockets django-rest-framework

我正在尝试在 iOS 设备上播放视频。当我尝试播放时出现以下错误:

[27/Apr/2015 06:59:30] "GET /media/2015/04/VID_20150327_112644.mp4 HTTP/1.1" 200 18

 Exception happened during processing of request from ('192.168.1.230', 51412)
Traceback (most recent call last):
  File "/usr/lib/python2.7/SocketServer.py", line 593, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/home/likewise-open/ZEALOUSYS/manesh/virtualenv/tracks/local/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 129, in __init__
    super(WSGIRequestHandler, self).__init__(*args, **kwargs)
  File "/usr/lib/python2.7/SocketServer.py", line 651, in __init__
    self.finish()
  File "/usr/lib/python2.7/SocketServer.py", line 710, in finish
    self.wfile.close()
  File "/usr/lib/python2.7/socket.py", line 279, in close
    self.flush()
  File "/usr/lib/python2.7/socket.py", line 303, in flush
    self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
----------------------------------------
Exception happened during processing of request from ('192.168.1.230', 51412)
Traceback (most recent call last):
  File "/usr/lib/python2.7/SocketServer.py", line 593, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/home/likewise-open/ZEALOUSYS/manesh/virtualenv/tracks/local/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 129, in __init__
    super(WSGIRequestHandler, self).__init__(*args, **kwargs)
  File "/usr/lib/python2.7/SocketServer.py", line 651, in __init__
    self.finish()
  File "/usr/lib/python2.7/SocketServer.py", line 710, in finish
    self.wfile.close()
  File "/usr/lib/python2.7/socket.py", line 279, in close
    self.flush()
  File "/usr/lib/python2.7/socket.py", line 303, in flush
    self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
----------------------------------------

所有格式的视频文件在所有浏览器和安卓设备上都能完美运行。当我尝试从 iOS 设备访问它时。它给了我上述错误。正如您在错误中看到的那样,首先它给我的响应是 200,然后是破损的管道。这个破管到底是什么意思?仅供引用,我已经发布了一个问题,说明我无法在 iOS 设备上播放视频,我现在发布一个新问题,因为我在我的终端中发现了这个错误。

我该如何解决这个问题?感谢您的帮助。

最佳答案

这是因为 django 正在处理您的媒体文件而不是 apache。尝试更改服务器中的配置。

例如,在您的 apache2 编辑 example.com.conf 文件中添加以下行,以便 apache 提供媒体文件。

**Alias /media /your project path/media**

有时这可能会解决这个问题。

关于python - 处理来自 IOS 设备的请求时发生异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29888374/

相关文章:

python - 运行使用 scrapy 和 selenium 创建的解析器时出现问题

python - 如何在没有循环的情况下将多个 Pandas DF 列更改为分类

python - 迭代Python列表: order of iteration

iphone - Objective C 在自动释放对象上泄漏内存

ios - 更改文本颜色 UINavigationBar

ios - cocos2d中的枪射击

django - 如何自动更新 Django 管理站点中的 slug 字段?

python - 如何定义只能调用一次的可调用对象?

Django 。如何获取 session 并将其保存为外键。

javascript - 通过 Ajax 向 Django 发送复选框列表