def run_backend(): global _config _config = get_config() # Create default user if in single user mode if not _config.auth.secret_key: logging.info('Single user mode') _init_default_user() else: logging.info('Multiple user mode') CORS(app, resources={r"/*": {"origins": "*"}}) app.run( host=_config.web.host, port=_config.web.port, debug=_config.web.debug, use_reloader=False, )
from plynx.utils.config import get_config, set_parameter from plynx.service.master import run_master from plynx.service.worker import run_worker from plynx.service.users import run_users from plynx.service.cache import run_cache from plynx.web.common import run_backend from plynx.utils.logs import set_logging_level Arg = namedtuple( 'Arg', ['flags', 'help', 'action', 'default', 'nargs', 'type', 'levels'] ) Arg.__new__.__defaults__ = (None, None, None, None, None, None) _config = get_config() def backend(args): set_logging_level(args.pop('verbose')) run_backend(**args) def cache(args): set_logging_level(args.pop('verbose')) run_cache(**args) def master(args): set_logging_level(args.pop('verbose')) run_master(**args)