def _preconfigure(project_root, config_filename='settings.py', argv=[]):
    tornado.options.parse_command_line(argv)
    tornado.options.parse_config_file(os.path.join(project_root, config_filename))

    dsettings = {}
    parsed_options = getattr(options, '_options', options)
    for key in parsed_options:
        dsettings[key] = getattr(options, key)
    
    _ensure_defaults(dsettings, options, project_root, config_filename)

    config = __import__('settings')
    for name in dir(config):
        if not name.startswith('_'):
            dsettings[name] = getattr(config, name)

    settings.__dict__.update(**dsettings)
    
    settings.socket_io_port = settings.port

    return dsettings
Read config file, process command-line args
dataset/ETHPy150Open letolab/airy/airy/core/conf.py/_preconfigure