Exemple #1
0
def main():
    """
    Main entrypoint script, will initialize the application, configure server and serve (blocking).
    """
    init_app()
    configure()
    serve_forever()
Exemple #2
0
def run_server(argv=None):
    if argv is None:
        argv = sys.argv
        
    parser = optparse.OptionParser(description='Run the ensconce cherrypy server.')
    init_app()
    
    parser.add_option('-d', '--debug',
                      default=config.get('debug', False),
                      action="store_true",
                      help='Run in debug mode?')
    
    (options, args) = parser.parse_args()
    
    config['debug'] = options.debug
    server.configure()
    server.serve_forever()
"""
This is a helper module that effectively configures the application at import time.

This exists for cherryd to be able to simply call `import ensconce.server_autoconfig`
and have cherrypy be fully configured (with default config file paths, etc) for serving.
"""
from ensconce import config
from ensconce import server

# Module-level initialization is deliberate here.  This should only ever be imported
# by cherryd.

config.init_app()
server.configure()