Sri*_*aju 2 python twisted twisted.web twisted.internet twisted.client
我写了一个简单的扭曲服务器 -
from twisted.internet import reactor
from twisted.internet import protocol
from twisted.web import server, resource
from twisted.internet import reactor
class Index(resource.Resource):
isLeaf = True
def render_GET(self, request):
args = request.args
print 'Args: %s' %(repr(args))
print 'Serving on PORT: 8090'
site = server.Site(Index())
reactor.listenTCP(8090, site)
reactor.run()
Run Code Online (Sandbox Code Playgroud)
这运行得很好127.0.0.1:8090.注意这在终端(前景)中运行,当我使用nohup&在后台运行进程时ctrl+Z.服务器不响应请求.我应该怎么做才能守护这个扭曲的服务器
我建议调查一下.这样你就不必担心处理任何启动,pid文件管理等问题.他们网站上的文档非常好:http://twistedmatrix.com/documents/current/core/howto/basics. HTML.另请查看http://twistedmatrix.com/documents/current/core/howto/tap.html以了解如何实施应用程序文件.