本文共 1636 字,大约阅读时间需要 5 分钟。
bin.html
{% if context.pic %} {% for li in context.pic %}{% load static %}{% empty %}名前:{
{context.person.0}} 年目:{ {context.person.1}} メール:{ {li}}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/