Example #1
0
 def setup(self, environ=None):
     '''Set up the :class:`.WsgiHandler` the first time this
     middleware is accessed.
     '''
     from django.conf import settings
     from django.core.wsgi import get_wsgi_application
     #
     app = get_wsgi_application()
     green_workers = self.cfg.greenlet if self.cfg else 0
     if greenio and green_workers:
         if pg:
             pg.make_asynchronous()
         app = greenio.RunInPool(app, green_workers)
         self.green_safe_connections()
     else:
         app = middleware_in_executor(app)
     return WsgiHandler((wait_for_body_middleware, app))
Example #2
0
 def setup(self, environ=None):
     '''Set up the :class:`.WsgiHandler` the first time this
     middleware is accessed.
     '''
     from django.conf import settings
     from django.core.wsgi import get_wsgi_application
     #
     try:
         dotted = settings.WSGI_APPLICATION
     except AttributeError:  # pragma nocover
         dotted = None
     if dotted:
         app = module_attribute(dotted)
     else:
         app = get_wsgi_application()
     green_workers = self.cfg.greenlet if self.cfg else 0
     if greenio and green_workers:
         if pg:
             pg.make_asynchronous()
         app = greenio.RunInPool(app, green_workers)
         self.green_safe_connections()
     else:
         app = middleware_in_executor(app)
     return WsgiHandler((wait_for_body_middleware, app))
Example #3
0
 def register(cls):
     '''Postgresql requires the greenlet libraries and psycopg2
     '''
     from pulsar.apps.greenio import pg
     pg.make_asynchronous()
Example #4
0
 def register(cls):
     '''Postgresql requires the greenlet libraries and psycopg2
     '''
     from pulsar.apps.greenio import pg
     pg.make_asynchronous()