CherryPy / cherrypy / scaffold / cpdeploy.py

The branch '598-sendall' does not exist.
#! /usr/bin/env python
"""Deployment script for <MyProject> (a CherryPy application).

Run this from the command-line and give it a --config argument:

    python cpdeploy.py --config=example.conf

"""

import os
local_dir = os.path.join(os.getcwd(), os.path.dirname(__file__))

import cherrypy
from cherrypy.restsrv.plugins import Daemonizer, PIDFile

# TODO: Change this to import your project root.
from cherrypy import scaffold


if __name__ == "__main__":
    from optparse import OptionParser
    
    p = OptionParser()
    p.add_option('-c', '--config', dest='config_file',
                 help="specify a config file")
    p.add_option('-D', '--daemonize', action="store_true", dest='daemonize',
                 help="run the server as a daemon")
    options, args = p.parse_args()
    cherrypy.config.update(options.config_file)
    
    # Only daemonize if asked to.
    if options.daemonize:
        # Don't print anything to stdout/sterr.
        cherrypy.config.update({'log.screen': False})
        
        d = Daemonizer(cherrypy.engine)
        d.subscribe()
    
    pidfile = cherrypy.config.get('pidfile')
    if pidfile:
        PIDFile(cherrypy.engine, pidfile).subscribe()
    
    # You can replace the next 4 lines with:
    # cherrypy.quickstart(scaffold.root, "/", options.config_file)
    cherrypy.signal_handler.subscribe()
    cherrypy.tree.mount(scaffold.root, "/", options.config_file)
    cherrypy.engine.start()
    cherrypy.engine.block()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.