コード例 #1
0
def waitress_main(args=None):
    """
    Configure + start Plone behind waitress from the given PasteDeploy
    configuration
    Waitress - unlike uwsgi - expects us to do the
    PasteDeploy stuff on our own.
    """
    ini_filename = args[-1]
    config_loader = ConfigLoader(ini_filename)
    server_config = config_loader.get_context(SERVER)
    serve = server_config.create()
    app_config = config_loader.get_context(APP)
    zope_conf = app_config.local_conf['zope_conf']
    wsgiapp = make_wsgi_app(app_config.global_conf, zope_conf)
    serve(wsgiapp)
コード例 #2
0
ファイル: daemon.py プロジェクト: TankMermaid/META-pipe
def __app_config(ini_path, app_name):
    config = ConfigLoader(ini_path).app_context(app_name).config()
    return config
コード例 #3
0
ファイル: daemon.py プロジェクト: TankMermaid/META-pipe
 def load(self):
     ini_path = self.ini_path
     app_name = self.app_name
     config = ConfigLoader(ini_path).app_context(app_name).config()
     return config
コード例 #4
0
            app_runner(execfile)(pyfile, _globals, dict(app=app, browser=browser))


def shell_runner(app, browser):
    ns = dict(app=app, browser=browser)
    interactive_shell = getattr(app, '__interact__', None)
    if interactive_shell is None:
        print ("The application %r doesn't have a specific __interact__ "
                "debugging method. Spawning a generic one." % app)
        interactive_shell = make_shell
    interactive_shell(banner="Python@ASD-project", **ns)


def runner(app, browser=None, pyfile=None):
    if pyfile is not None:
        return file_runner(app, browser, pyfile)
    shell_runner(app, browser)


parser = argparse.ArgumentParser()
parser.add_argument("ini", help="PythonPaste configuration file")
parser.add_argument("--app", help="Name of the app configuration section")
parser.add_argument("--file", help="python script to run")
parser.add_argument("--browser", help="Fake browser emulation", action="store_true")
args = parser.parse_args()
loader = ConfigLoader(args.ini)

app = args.app and loader.get_app(args.app) or loader.get_app()
browser = args.browser and Browser(app) or None
runner(app, browser, pyfile=args.file)