博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
django加载视频出现10053
阅读量:366 次
发布时间:2019-03-04

本文共 1636 字,大约阅读时间需要 5 分钟。

bin.html

{% if context.pic %} {% for li in context.pic %}
{% load static %}

名前:{

{context.person.0}}
年目:{
{context.person.1}}
メール:{
{li}}

{% empty %}
  • no!
  • {% endfor %} {% endif %}

    views.py

    def bing(request):    template=loader.get_template("bin.html")    pic_root="你的视频目录,setting配置需要修改一致。"    root = os.listdir(pic_root)    list_root=[]    for r in root:        list_root.append(r)    context={"title":"日本語の世界に入ってくだい!","time":datetime.datetime.now(),"person":["Tory",21,"東京"],"pic":list_root,"num":len(list_root)}    request_context = RequestContext(request, context)    request_context.push(locals())    html=template.render(context=locals(), request=request)    return HttpResponse(html)

    setting.py

    Vedio_DIR="你的视频目录"STATIC_URL = '/static/'STATICFILES_DIRS = [     os.path.join(Vedio_DIR)]

    在这里插入图片描述

    错误(虽有错误,运行正常,错误异常处理即可)

    File "C:\Python27\lib\socket.py", line 307, in flush    self._sock.sendall(buffer(data, write_offset, buffer_size))error: [Errno 10053]#您的主机中止了一个已建立的连接。

    解决(A,B同时建立连接,其中一个被终止。A或B被终止后不断尝试重连,不断循环)

    C:\Python27\lib\socket.pydef flush(self): .... ....  while write_offset < data_size:     self._sock.sendall(view[write_offset:write_offset+buffer_size])     write_offset += buffer_size       .... ....改为=>def flush(self): .... .... while write_offset < data_size:	try:		self._sock.sendall(view[write_offset:write_offset+buffer_size])		write_offset += buffer_size	except Exception as e:		pass

    存在问题

    局域网内手机连接后,无法访问视频,下载中也无法观看(电脑端正常)。若哪位大神看到,求告知!

    转载地址:http://alrr.baihongyu.com/

    你可能感兴趣的文章