【问题标题】:bottle.py WSGI server stops respondingbottle.py WSGI 服务器停止响应
【发布时间】:2013-02-06 00:21:12
【问题描述】:

我正在尝试使用 bottle.py (Bottle v0.11.4) Web 框架构建一个简单的 API。为了在我的服务器(Ubuntu 10.04.4)上“守护”应用程序,我正在运行 shell

nohup python test.py &

,其中 test.py 是以下 python 脚本:

import sys
import bottle
from bottle import route, run, request, response, abort, hook

@hook('after_request')
def enable_cors():
  response.headers['Access-Control-Allow-Origin'] = '*'

@route('/')
def ping():
  return 'Up and running!'

if __name__ == '__main__':
  run(host=<my_ip>, port=3000)

我遇到了以下问题:

这最初有效,但服务器会在一段时间后(约 24 小时)停止响应。不幸的是,日志不包含任何暴露的错误消息。

我能够重现该问题的唯一方法是,当我尝试在我的 Ubuntu 服务器上运行第二个脚本时,该脚本会创建另一个侦听不同端口的服务器(即:与上面完全相同的脚本,但 port=3001 )。如果我向新创建的服务器发送请求,我也没有得到响应,并且连接最终会超时。

非常感谢任何建议。我是新手,所以如果这种方法存在根本性的问题,任何指向参考指南的链接也将不胜感激。谢谢!

【问题讨论】:

    标签: wsgi ubuntu-10.04 bottle


    【解决方案1】:

    你能确定服务器没有休眠吗? 如果是,请尝试启用 Wake On LAN http://ubuntuforums.org/showthread.php?t=234588

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-04
      • 2015-05-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多