1. cherrypy
  2. CherryPy


Gustavo Picon  committed f24a7bf

PEP8ified cherryd

  • Participants
  • Parent commits d5f0924
  • Branches default

Comments (0)

Files changed (1)

File cherrypy/cherryd

View file
  • Ignore whitespace
 from cherrypy.process import plugins, servers
 from cherrypy import Application
 def start(configfiles=None, daemonize=False, environment=None,
           fastcgi=False, scgi=False, pidfile=None, imports=None,
     sys.path = [''] + sys.path
     for i in imports or []:
         exec("import %s" % i)
     for c in configfiles or []:
         # If there's only one app mounted, merge config into it.
             for app in cherrypy.tree.apps.values():
                 if isinstance(app, Application):
     engine = cherrypy.engine
     if environment is not None:
         cherrypy.config.update({'environment': environment})
     # Only daemonize if asked to.
     if daemonize:
         # Don't print anything to stdout/sterr.
         cherrypy.config.update({'log.screen': False})
     if pidfile:
         plugins.PIDFile(engine, pidfile).subscribe()
     if hasattr(engine, "signal_handler"):
     if hasattr(engine, "console_control_handler"):
     if (fastcgi and (scgi or cgi)) or (scgi and cgi):
         cherrypy.log.error("You may only specify one of the cgi, fastcgi, and "
                            "scgi options.", 'ENGINE')
         cherrypy.config.update({'engine.autoreload_on': False})
         # Turn off the default HTTP server (which is subscribed by default).
         addr = cherrypy.server.bind_addr
         if fastcgi:
             f = servers.FlupFCGIServer(application=cherrypy.tree,
         s = servers.ServerAdapter(engine, httpserver=f, bind_addr=addr)
     # Always start the engine; this will start all other services
 if __name__ == '__main__':
     from optparse import OptionParser
     p = OptionParser()
     p.add_option('-c', '--config', action="append", dest='config',
                  help="specify config file(s)")
     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")
+                 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',
     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)