Python cherrypy 模块,process() 实例源码

我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用cherrypy.process()

项目:autosub-bootstrapbill    作者:BenjV    | 项目源码 | 文件源码
def run():
    from optparse import OptionParser

    p = OptionParser()
    p.add_option('-c', '--config', action='append', dest='config',
                 help='specify config file(s)')
    p.add_option('-d', action='store_true', dest='daemonize',
                 help='run the server as a daemon')
    p.add_option('-e', '--environment', dest='environment', default=None,
                 help='apply the given config environment')
    p.add_option('-f', action='store_true', dest='fastcgi',
                 help='start a fastcgi server instead of the default HTTP '
                      'server')
    p.add_option('-s', action='store_true', dest='scgi',
                 help='start a scgi server instead of the default HTTP server')
    p.add_option('-x', action='store_true', dest='cgi',
                 help='start a cgi server instead of the default HTTP server')
    p.add_option('-i', '--import', action='append', dest='imports',
                 help='specify modules to import')
    p.add_option('-p', '--pidfile', dest='pidfile', default=None,
                 help='store the process id in the given file')
    p.add_option('-P', '--Path', action='append', dest='Path',
                 help='add the given paths to sys.path')
    options, args = p.parse_args()

    if options.Path:
        for p in options.Path:
            sys.path.insert(0, p)

    start(options.config, options.daemonize,
          options.environment, options.fastcgi, options.scgi,
          options.pidfile, options.imports, options.cgi)
项目:watcher    作者:nosmokingbandit    | 项目源码 | 文件源码
def run():
    from optparse import OptionParser

    p = OptionParser()
    p.add_option('-c', '--config', action="append", dest='config',
                 help="specify config file(s)")
    p.add_option('-d', action="store_true", dest='daemonize',
                 help="run the server as a daemon")
    p.add_option('-e', '--environment', dest='environment', default=None,
                 help="apply the given config environment")
    p.add_option('-f', action="store_true", dest='fastcgi',
                 help="start a fastcgi server instead of the default HTTP "
                      "server")
    p.add_option('-s', action="store_true", dest='scgi',
                 help="start a scgi server instead of the default HTTP server")
    p.add_option('-x', action="store_true", dest='cgi',
                 help="start a cgi server instead of the default HTTP server")
    p.add_option('-i', '--import', action="append", dest='imports',
                 help="specify modules to import")
    p.add_option('-p', '--pidfile', dest='pidfile', default=None,
                 help="store the process id in the given file")
    p.add_option('-P', '--Path', action="append", dest='Path',
                 help="add the given paths to sys.path")
    options, args = p.parse_args()

    if options.Path:
        for p in options.Path:
            sys.path.insert(0, p)

    start(options.config, options.daemonize,
          options.environment, options.fastcgi, options.scgi,
          options.pidfile, options.imports, options.cgi)