部署 CherryPy(守护进程) [英] Deploying CherryPy (daemon)
问题描述
我遵循了基本的 CherryPy 教程(http://www.cherrypy.org/wiki/CherryPyTutorial).没有讨论的一件事是部署.
I've followed the basic CherryPy tutorial (http://www.cherrypy.org/wiki/CherryPyTutorial). One thing not discussed is deployment.
如何将 CherryPy 应用程序作为守护程序启动并忘记它"?如果服务器重新启动会发生什么?
How can I launch a CherryPy app as a daemon and "forget about it"? What happens if the server reboots?
有标准配方吗?也许会创建一个服务脚本(/etc/init.d/cherrypy...)
Is there a standard recipe? Maybe something that will create a service script (/etc/init.d/cherrypy...)
谢谢!
推荐答案
有一个 Daemonizer 插件,这对于启动它很有用,但到目前为止,对于简单情况,最简单的方法是使用cherryd 脚本:
There is a Daemonizer plugin for CherryPy included by default which is useful for getting it to start but by far the easiest way for simple cases is to use the cherryd script:
> cherryd -h
Usage: cherryd [options]
Options:
-h, --help show this help message and exit
-c CONFIG, --config=CONFIG
specify config file(s)
-d run the server as a daemon
-e ENVIRONMENT, --environment=ENVIRONMENT
apply the given config environment
-f start a fastcgi server instead of the default HTTP
server
-s start a scgi server instead of the default HTTP server
-i IMPORTS, --import=IMPORTS
specify modules to import
-p PIDFILE, --pidfile=PIDFILE
store the process id in the given file
就 init.d 脚本而言,我认为有些示例可以在 Google 上搜索.
As far as an init.d script goes I think there are examples that can be Googled.
cherryd
位于您的:
virtualenv/lib/python2.7/site-packages/cherrypy/cherryd
virtualenv/lib/python2.7/site-packages/cherrypy/cherryd
或在:https://bitbucket.org/cherrypy/cherrypy/src/default/cherrypy/cherryd
这篇关于部署 CherryPy(守护进程)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!