我有一个小型WebApp,其中包含一个小表单,用户必须输入一些凭据,然后将其发布到我的瓶子应用程序中。输入得到验证(通过一堆sql调用),如果一切正常,他会收到邮件。 问题是:在运行服务器之后,一切都很好,我得到这样的错误:
Traceback (most recent call last): File "/usr/local/lib/python2.7/SocketServer.py", line 295, in
_handle_request_noblock
self.process_request(request, client_address) File "/usr/local/lib/python2.7/SocketServer.py", line 321, in process_request
self.finish_request(request, client_address) File "/usr/local/lib/python2.7/SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self) File "/usr/local/lib/python2.7/SocketServer.py", line 651, in __init__
self.finish() File "/usr/local/lib/python2.7/SocketServer.py", line 710, in finish
self.wfile.close() File "/usr/local/lib/python2.7/socket.py", line 279, in close
self.flush() File "/usr/local/lib/python2.7/socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
我GET
和POST
方面的功能如下:
@get("/myroute")
def show_form():
form = CreateVoucherForm()
return generate_form(form)
@post("/myroute")
def validate_storno():
formdict = dict(request.forms)
form = CreateVoucherForm(**formdict)
if form.validate() and has_no_logic_errors(form):
#query some SQL
#send the user mail and give him the same form with success msg
mail(form)
return generate_form(form, "Success")
else:
#return form and deny msg
return generate_form(form, "Access Denied!")
我已经在SO:
阅读了这些主题但是给定的解决方案(如果有的话)在我的案例中不起作用。唯一似乎有帮助的是重启服务器。在那之后,一切都会再次运作,直到下一个小时。
有可能从这种情况中恢复过来吗?
我不想每小时安装一个cronjob重新启动我的服务器,这太可疑了。如果您建议使用其他服务器,它应该像瓶子一样容易使用。我也不想使用像django这样的完整框架,因为这是一个沉重的观察者。