예제 #1
0
    def run(self):
        if self.cfg.check_config:
            try:
                self.load()
            except:
                sys.stderr.write("\nError while loading the application:\n\n")
                traceback.print_exc()
                sys.stderr.flush()
                sys.exit(1)
            sys.exit(0)

        if self.cfg.spew:
            debug.spew()
        if self.cfg.daemon:
            util.daemonize()

        # set python paths
        if self.cfg.pythonpath and self.cfg.pythonpath is not None:
            paths = self.cfg.pythonpath.split(",")
            for path in paths:
                pythonpath = os.path.abspath(self.cfg.pythonpath)
                if pythonpath not in sys.path:
                    sys.path.insert(0, pythonpath)

        try:
            Arbiter(self).run()
        except RuntimeError as e:
            sys.stderr.write("\nError: %s\n\n" % e)
            sys.stderr.flush()
            sys.exit(1)
예제 #2
0
    def run(self):
        if self.cfg.check_config:
            try:
                self.load()
            except:
                msg = "\nError while loading the application:\n"
                print(msg, file=sys.stderr)
                traceback.print_exc()
                sys.stderr.flush()
                sys.exit(1)
            sys.exit(0)

        if self.cfg.spew:
            debug.spew()

        if self.cfg.daemon:
            util.daemonize(self.cfg.enable_stdio_inheritance)

        # set python paths
        if self.cfg.pythonpath:
            paths = self.cfg.pythonpath.split(",")
            for path in paths:
                pythonpath = os.path.abspath(path)
                if pythonpath not in sys.path:
                    sys.path.insert(0, pythonpath)

        super().run()
예제 #3
0
파일: base.py 프로젝트: quanpower/gunicorn
    def run(self):
        if self.cfg.check_config:
            try:
                self.load()
            except:
                msg = "\nError while loading the application:\n"
                print(msg, file=sys.stderr)
                traceback.print_exc()
                sys.stderr.flush()
                sys.exit(1)
            sys.exit(0)

        if self.cfg.spew:
            debug.spew()

        if self.cfg.daemon:
            util.daemonize(self.cfg.enable_stdio_inheritance)

        # set python paths
        if self.cfg.pythonpath:
            paths = self.cfg.pythonpath.split(",")
            for path in paths:
                pythonpath = os.path.abspath(path)
                if pythonpath not in sys.path:
                    sys.path.insert(0, pythonpath)

        super(Application, self).run()
예제 #4
0
    def run(self):
        if self.cfg.check_config:
            try:
                self.load()
            except:
                sys.stderr.write("\nError while loading the application:\n\n")
                traceback.print_exc()
                sys.stderr.flush()
                sys.exit(1)
            sys.exit(0)

        if self.cfg.spew:
            debug.spew()
        if self.cfg.daemon:
            util.daemonize()

        # set python paths
        if self.cfg.pythonpath and self.cfg.pythonpath is not None:
            paths = self.cfg.pythonpath.split(",")
            for path in paths:
                pythonpath = os.path.abspath(self.cfg.pythonpath)
                if pythonpath not in sys.path:
                    sys.path.insert(0, pythonpath)

        try:
            Arbiter(self).run()
        except RuntimeError as e:
            sys.stderr.write("\nError: %s\n\n" % e)
            sys.stderr.flush()
            sys.exit(1)
예제 #5
0
파일: base.py 프로젝트: thomasst/gunicorn
 def run(self):
     if self.cfg.spew:
         debug.spew()
     if self.cfg.daemon:
         util.daemonize()
     else:
         os.setpgrp()
     self.configure_logging()
     Arbiter(self).run()
예제 #6
0
    def run(self):
        # enable detailed debug logging
        if self.cfg.spew:
            debug.spew()

        # change working directory
        os.chdir(self.cfg.chdir)

        # run gunicorn
        super().run()
예제 #7
0
파일: base.py 프로젝트: timf/gunicorn
 def run(self):
     if self.cfg.spew:
         debug.spew()
     if self.cfg.daemon:
         # daemonize should not close logfile fd, see method doc
         self.close_logfile()
         util.daemonize()
         self.configure_logging()
     else:
         os.setpgrp()
     Arbiter(self).run()
예제 #8
0
파일: base.py 프로젝트: clement/gunicorn
 def run(self):
     if self.cfg.spew:
         debug.spew()
     if self.cfg.daemon:
         util.daemonize()
     else:
         try:
             os.setpgrp()
         except OSError, e:
             if e[0] != errno.EPERM:
                 raise
예제 #9
0
파일: base.py 프로젝트: batok/gunicorn
 def run(self):
     if self.cfg.spew:
         debug.spew()
     if self.cfg.daemon:
         util.daemonize()
     else:
         try:
             os.setpgrp()
         except OSError, e:
             if e[0] == errno.EPERM:
                 sys.stderr.write("Error: You should use "
                     "daemon mode here.\n")
             raise
예제 #10
0
    def run(self):
        if self.cfg.check_config:
            try:
                self.load()
            except Exception:
                msg = "Error while loading the application"
                sys.exit(msg)

            sys.exit(0)

        if self.cfg.spew:
            debug.spew()

        if self.cfg.daemon:
            util.daemonize(self.cfg.enable_stdio_inheritance)

        super().run()
예제 #11
0
    def run(self):
        # 配置校验无误
        if self.cfg.check_config:
            try:
                # 加载配置
                self.load()
            except:
                msg = "\nError while loading the application:\n"
                print(msg, file=sys.stderr)
                # 打印异常信息
                traceback.print_exc()
                # 清空标准错误信息
                sys.stderr.flush()
                sys.exit(1)
            sys.exit(0)

        if self.cfg.spew:
            # 打开了--spew开关
            # Install a trace function that spews every line
            # executed by the server.
            debug.spew()

        if self.cfg.daemon:
            # run in daemon mode
            util.daemonize(self.cfg.enable_stdio_inheritance)

        # set python paths
        if self.cfg.pythonpath:
            paths = self.cfg.pythonpath.split(",")
            for path in paths:
                pythonpath = os.path.abspath(path)
                if pythonpath not in sys.path:
                    sys.path.insert(0, pythonpath)

        # 运行入口
        super().run()
예제 #12
0
 def reload(self):
     self.do_load_config()
     if self.cfg.spew:
         debug.spew()
예제 #13
0
 def reload(self):
     self.do_load_config()
     if self.cfg.spew:
         debug.spew()
예제 #14
0
파일: base.py 프로젝트: batok/gunicorn
 def reload(self):
     self.load_config()
     if self.cfg.spew:
         debug.spew()
     loglevel = self.LOG_LEVELS.get(self.cfg.loglevel.lower(), logging.INFO)
     self.logger.setLevel(loglevel)