예제 #1
0
파일: bench.py 프로젝트: wooque/bench
    def __init__(self):
        self.db_pool = adbapi.ConnectionPool("psycopg2", host="127.0.0.1", database="bench",
                                             user="******", password="******", cp_max=32, cp_reconnect=True)

        handlers = [
            (r"/bench", BenchEndpoint, dict(db=self.db_pool)),
        ]
        Application.__init__(self, handlers, dict(xheaders=True))
예제 #2
0
 def __init__(self):
     handlers = []
     add_versioned_resource_urls(handlers, ResourceSet("test", {1: TestResource, 2: V2TestResource}), prefix="/api")
     add_versioned_resource_urls(
         handlers, ResourceSet("another", {1: AnotherResource, 2: AnotherResource}), prefix="/api"
     )
     add_versioned_resource_urls(handlers, MyOwnResourceSet(), prefix="/api")
     Application.__init__(self, handlers, debug=True)
예제 #3
0
파일: server.py 프로젝트: praekelt/echidna
 def __init__(self, root, **settings):
     self.store = InMemoryCardStore()
     handlers = [
         (r"/", root),
         (r"/publish/(?P<channel>.*)/", PublicationHandler,
          dict(store=self.store)),
         (r"/subscribe", SubscriptionHandler, dict(store=self.store)),
     ]
     Application.__init__(self, handlers, **settings)
예제 #4
0
파일: server.py 프로젝트: praekelt/echidna
 def __init__(self, root, **settings):
     self.store = InMemoryCardStore()
     handlers = [
         (r"/", root),
         (r"/publish/(?P<channel>.*)/", PublicationHandler,
          dict(store=self.store)),
         (r"/subscribe", SubscriptionHandler,
          dict(store=self.store)),
     ]
     Application.__init__(self, handlers, **settings)
예제 #5
0
 def __init__(self, config_file=None, **settings):
     if self.config_required and config_file is None:
         raise ValueError(
             "Please specify a config file using --appopts=<config.yaml>")
     config = self.get_config_settings(config_file)
     self.setup_factory_preprocessor(config)
     self.initialize(settings, config)
     path_prefix = self._get_configured_path_prefix(config)
     routes = self._build_routes(path_prefix)
     Application.__init__(self, routes, **settings)
예제 #6
0
    def __init__(self):
        self.db_pool = txpostgres.ConnectionPool("psycopg2", host="127.0.0.1", database="bench", 
                                                 user="******", password="******", min=32)

        d = self.db_pool.start()
        d.addCallback(lambda _: log.msg("DB connected"))

        handlers = [
            (r"/bench", BenchEndpoint, dict(db=self.db_pool)),
        ]
        Application.__init__(self, handlers, dict(xheaders=True))
예제 #7
0
 def __init__(self):
     handlers = []
     add_versioned_resource_urls(handlers,
                                 ResourceSet("test", {
                                     1: TestResource,
                                     2: V2TestResource
                                 }),
                                 prefix="/api")
     add_versioned_resource_urls(handlers,
                                 ResourceSet("another", {
                                     1: AnotherResource,
                                     2: AnotherResource
                                 }),
                                 prefix="/api")
     add_versioned_resource_urls(handlers,
                                 MyOwnResourceSet(),
                                 prefix="/api")
     Application.__init__(self, handlers, debug=True)