def __init__(self, *args, gunicorn_cfg: ConfigDict = None, log_cfg: ConfigDict = None, **kwargs): self._log_cfg = log_cfg self._cfg = gunicorn_cfg or {} self._cfg.setdefault('worker_class', 'gevent') self._cfg.setdefault('workers', 1) self.__on_starting = self._cfg.get('on_starting') self._cfg['on_starting'] = self._on_starting if log_cfg: self._cfg['post_fork'] = self._init_logging FlaskServer.__init__(self, *args, **kwargs) Application.__init__(self) self._arbiter = None
def __init__(self, app, port, **kwargs): self.app = app self.port = port self.opts = kwargs Application.__init__(self)
def __init__(self, app, options=None): self.options = options or {} self.app = app Application.__init__(self, None)
def __init__(self, app): Application.__init__(self) self.cfg = None self.log = None self.app = app
def run(self, **options): self.cfg = Config() for key, value in options.items(): self.cfg.set(key, value) return Application.run(self)
def run(self, **options): self.cfg = Config() [self.cfg.set(key, value) for key, value in options.items()] return Application.run(self)