當前位置: 首頁>>代碼示例>>Python>>正文


Python cherrypy.process方法代碼示例

本文整理匯總了Python中cherrypy.process方法的典型用法代碼示例。如果您正苦於以下問題:Python cherrypy.process方法的具體用法?Python cherrypy.process怎麽用?Python cherrypy.process使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在cherrypy的用法示例。


在下文中一共展示了cherrypy.process方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: run

# 需要導入模塊: import cherrypy [as 別名]
# 或者: from cherrypy import process [as 別名]
def run():
    """Run cherryd CLI."""
    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) 
開發者ID:cherrypy,項目名稱:cherrypy,代碼行數:35,代碼來源:daemon.py

示例2: main

# 需要導入模塊: import cherrypy [as 別名]
# 或者: from cherrypy import process [as 別名]
def main():
    from optparse import OptionParser

    p = OptionParser()
    p.add_option('-c', '--config', dest='config',
                 help="specify config file")
    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('-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")
    p.add_option('-D', '--debug', action="store_true", dest='debug',
                 help="debug to stderr in foreground")
    options, args = p.parse_args()

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

    if options.config is None:
        print('-c|--config <path/to/config/file> is mandatory')
        exit(1)

    if not os.path.isfile(options.config):
        print('configuration file "' + options.config + '" doesn\'t exist')
        exit(1)

    start(options.config, options.daemonize,
          options.environment, options.fastcgi, options.scgi,
          options.pidfile, options.cgi, options.debug) 
開發者ID:kakwa,項目名稱:ldapcherry,代碼行數:42,代碼來源:cli.py

示例3: run

# 需要導入模塊: import cherrypy [as 別名]
# 或者: from cherrypy import process [as 別名]
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) 
開發者ID:morpheus65535,項目名稱:bazarr,代碼行數:34,代碼來源:daemon.py


注:本文中的cherrypy.process方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。