main.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:chess-api 作者: ncksllvn 项目源码 文件源码
def setup():
    system = platform.system()
    engine_path = os.path.dirname(__file__)
    engine_paths = dict([
        ('Darwin', 'engines/stockfish/Mac/stockfish-7-64'),
        ('Linux', 'engines/stockfish/Linux/stockfish-7-x64'),
        ('Linux2', 'engines/stockfish/Linux/stockfish-7-x64'),
    ])

    if not system in engine_paths:
        raise Exception('No engine for OS')

    engine_path = os.path.join(engine_path, engine_paths[system])
    environment = os.environ['ENVIRONMENT'] if 'ENVIRONMENT' in os.environ else 'PRODUCTION'
    port = 5000
    debug = True

    if environment != 'development':
        port = os.environ.get('PORT', 5000)
        debug = False

    define('port', default=port, help='run on the given port', type=int)
    define('debug', default=debug, help='run in debug mode')
    define('path-to-engine', default=engine_path, help='the location of the chess engine')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号