コード例 #1
0
ファイル: napoli.py プロジェクト: gengo/napoli
 def __init__(self):
     super(Napoli, self).__init__()
     if getattr(self, '__init', False):
         # do initialization here
         self.config = Config.get_instance()
         os.environ['APPPATH'] = self.config.application
         sys.path.append(os.path.dirname(os.environ['APPPATH']))
         self.log = Log()
         self.plugins = Plugins()
         self._load_plugins()
         self.routes = Routes()
コード例 #2
0
ファイル: decanter.py プロジェクト: hayate/decanter
    def __init__(self, app, hostname='localhost', port=9000,
                 pidfile='/var/run/decanter.pid', development=False):
        self.app = app
        self.hostname = hostname
        self.port = int(port)
        self.pidfile = pidfile
        self.config = Config.get_instance()

        if 'timezone' in self.config:
            os.environ['TZ'] = self.config.timezone

        # remove all default bottle plugins
        bottle.uninstall(True)
        bottle.DEBUG = self.config.debug
        # install plugins
        self.install(plugins=self.config.plugins)
        if self.config.debug or not development:
            stdout = os.popen('tty').read().strip()
            stderr = os.popen('tty').read().strip()

        if not development:
            super(Decanter, self).__init__(
                pidfile, stdout=stdout, stderr=stderr)