コード例 #1
0
ファイル: upgrade.py プロジェクト: RebelFist/ecm
def run(command, global_options, options, args):
    if not args:
        command.parser.error('Missing instance directory.')
    instance_dir = args[0]
    sqlite_db_dir = ''
    config = SafeConfigParser()
    if config.read([path.join(instance_dir, 'settings.ini')]):
        sqlite_db_dir = config.get('database', 'sqlite_db_dir')
    if not sqlite_db_dir:
        sqlite_db_dir = path.join(instance_dir, 'db')

    # upgrade files from template
    upgrade_instance_files(instance_dir, config)

    # run collectstatic
    collect_static_files(instance_dir, options)

    # migrate ecm db
    if not options.no_syncdb:
        migrate_ecm_db(instance_dir, options.upgrade_from_149)

    log('')
    log('ECM instance upgraded in "%s".' % instance_dir)

    print_load_message(instance_dir, config.get('database', 'ecm_engine'))
    print_usage_feedback_message()