Example #1
0
def create_application(debug):
    application = tornado.web.Application(route.get_routes(),
                                          scripts=create_collection(
                                              config['directory']),
                                          debug=debug)

    return application
Example #2
0
def create_application(debug):
    application = tornado.web.Application(
        route.get_routes(), 
        scripts=create_collection(config['directory']),
        debug=debug
    )
    
    return application
Example #3
0
def create_application(debug):
    # import the handler file, this will fill out the route.get_routes() call.
    import pyjojo.handlers

    application = tornado.web.Application(
        route.get_routes(), 
        scripts=create_collection(config['directory']),
        debug=debug
    )
    
    return application
Example #4
0
def create_application(debug):
    # import the handler file, this will fill out the route.get_routes() call.
    import pyjojo.handlers

    application = tornado.web.Application(
        route.get_routes(), 
        scripts=create_collection(config['directory']),
        debug=debug
    )
    
    return application
Example #5
0
def main():
    """ entry point for the application """
    
    root = os.path.dirname(__file__)
        
    # get the command line options
    options = command_line_options()
    handler = setup_logging()

    # import the handler file, this will fill out the route.get_routes() call.
    import pyjojo.handlers

    # setup the application
    log.info("Setting up the application")
    
    application = tornado.web.Application(
        route.get_routes(), 
        scripts=create_collection(config['directory']),
        debug=options.debug
    )
    
    # if we're passed a certfile and keyfile, start the app as an HTTPS server, 
    # otherwise use HTTP. 
    if options.certfile and options.keyfile:        
        server = HTTPServer(application, ssl_options={
            "certfile": options.certfile,
            "keyfile": options.keyfile
        })
    else:
        log.warn("Application is running in HTTP mode, this is insecure.  Pass in the --certfile and --keyfile to use SSL.")
        server = HTTPServer(application)

    # set the server port and fork subprocesses to run
    server.bind(options.port, options.address)
    server.start(1)
    
    # start the ioloop
    log.info("Starting the IOLoop")
    IOLoop.instance().start()
Example #6
0
 def post(self):
     """ reload the scripts from the script directory """
     self.settings['scripts'] = create_collection(config['directory'])
     self.finish({"status": "ok"})