コード例 #1
0
        core.CONF_FILE = os.path.join(core.PROG_PATH, core.CONF_FILE)
    from core import config
    conf = config.Config()
    if not os.path.isfile(core.CONF_FILE):
        print('Config file not found. Creating new basic config {}. Please review settings.'.format(core.CONF_FILE))
        conf.new_config()
    else:
        print('Config file found, merging any new options.')
        conf.merge_new_options()
    conf.stash()

    # Set up logging
    from core import log
    if passed_args.log:
        core.LOG_DIR = passed_args.log
    log.start(core.LOG_DIR)
    logging = logging.getLogger(__name__)
    cherrypy.log.error_log.propagate = True
    cherrypy.log.access_log.propagate = False

    # clean mako cache
    try:
        print("Clearing Mako cache.")
        shutil.rmtree(core.MAKO_CACHE)
    except Exception as e:
        print("Unable to clear Mako cache.")
        print(e)

    # Finish core application
    from core import api, config, postprocessing, scheduler
    from core.app import App
コード例 #2
0
ファイル: watcher.py プロジェクト: scambra/Watcher3
    core.sql = sqldb.SQL()
    core.sql.update_database()

    # set up config file on first launch
    from core import config
    if not os.path.isfile(core.CONF_FILE):
        print('\033[33m## Config file not found. Creating new basic config {}. Please review settings. \033[0m'.format(core.CONF_FILE))
        config.new_config()
    else:
        print('Config file found, merging any new options.')
        config.merge_new_options()
    config.load()

    # Set up logging
    from core import log
    log.start(core.LOG_DIR, passed_args.stdout or False)
    logging = logging.getLogger(__name__)
    cherrypy.log.error_log.propagate = True
    cherrypy.log.access_log.propagate = False

    # clean mako cache
    try:
        print('Clearing Mako cache.')
        shutil.rmtree(core.MAKO_CACHE)
    except FileNotFoundError:  # noqa: F821 : Flake8 doesn't know about some built-in exceptions
        pass
    except Exception as e:
        print('\033[31m Unable to clear Mako cache. \033[0m')
        print(e)

    # Finish core application
コード例 #3
0
    # set up config file on first launch
    from core import config
    conf = config.Config()
    if not os.path.isfile(core.CONF_FILE):
        print(
            '\033[33m Config file not found. Creating new basic config {}. Please review settings. \033[0m'
            .format(core.CONF_FILE))
        conf.new_config()
    else:
        print('Config file found, merging any new options.')
        conf.merge_new_options()
    conf.stash()

    # Set up logging
    from core import log
    log.start(core.LOG_DIR, passed_args.debug or False)
    logging = logging.getLogger(__name__)
    cherrypy.log.error_log.propagate = True
    cherrypy.log.access_log.propagate = False

    # clean mako cache
    try:
        print('Clearing Mako cache.')
        shutil.rmtree(core.MAKO_CACHE)
    except FileNotFoundError:
        pass
    except Exception as e:
        print('\033[31m Unable to clear Mako cache. \033[0m')
        print(e)

    # Finish core application