Files
rogaining_srv/run_migration.py

41 lines
1005 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python
"""
簡単な画像移行実行スクリプト
Dockerコンテナ内で実行可能
"""
import os
import sys
import django
from pathlib import Path
# Django settings setup
BASE_DIR = Path(__file__).resolve().parent
sys.path.append(str(BASE_DIR))
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
django.setup()
def main():
"""簡易移行実行"""
print("🔄 画像S3移行を開始します...")
try:
# 移行サービスをインポートDjango setup後
from migrate_local_images_to_s3 import ImageMigrationService
# 移行実行
migration_service = ImageMigrationService()
report = migration_service.run_migration()
print("\n✅ 移行完了!")
return report
except Exception as e:
print(f"\n💥 エラー発生: {str(e)}")
import traceback
traceback.print_exc()
return None
if __name__ == "__main__":
main()