我得到此异常将尝试访问图像,我得到blog_post_name,blog_post_content,但不是图像,看起来像是试图得到它,但它抛出了这个异常:
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 55134)
Traceback (most recent call last):
File "c:\Python27\lib\SocketServer.py", line 593, in process_request_thread
self.finish_request(request, client_address)
File "c:\Python27\lib\SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "c:\Python27\lib\site-packages\django\core\servers\basehttp.py", line 139, in __init__
super(WSGIRequestHandler, self).__init__(*args, **kwargs)
File "c:\Python27\lib\SocketServer.py", line 651, in __init__
self.finish()
File "c:\Python27\lib\SocketServer.py", line 710, in finish
self.wfile.close()
File "c:\Python27\lib\socket.py", line 279, in close
self.flush()
File "c:\Python27\lib\socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 10053] Se ha anulado una conexi¾n establecida por el software en su equipo host
----------------------------------------
Template.html
{% extends "base2.html" %}
{% block content %}
<div class="row">
<div class="large-6 columns">
{% if list_all_posts %}
{% for post in list_all_posts %}
<ul class="pricing-table">
<li class="title">{{ post.blog_post_name }}</li>
<li class="bullet-item">
<a class="fancybox" href="/media_files/{{ post.blog_post_image}}" title="{{ post.blog_post_content }}" >
<img src="/media_files/{{ post.blog_post_image}}" alt="" />
</a>
</li>
<li class="description">{{ post.blog_post_content}}</li>
</ul>
{% endfor %}
{% endif %}
</div>
</div>
{% endblock %}
view.py
def blogs(request):
blog_template = "blog.html"
list_all_posts = BlogEntry.objects.all()
print list_all_posts
return render(request, blog_template, locals())
答案 0 :(得分:0)
要解决此错误,只需增加请求超时时间即可。
在我的情况下,我是使用Nextp调用DRF端点的
api = Axios.create({
baseURL: C.API_BASE,
timeout: 1000
})
api.post(....)
在这种情况下,我的解决方案是增加timeout
的值