#!/usr/bin/env python3 """ Django ASGI + FastAPI + Gradio 統合起動 ======================================================== app.py から asgi.py を起動してすべて統合 """ import os import sys from dotenv import load_dotenv import subprocess # 環境変数読み込み load_dotenv() # プロジェクトルートをパスに追加 project_root = os.path.dirname(os.path.abspath(__file__)) sys.path.append(project_root) # Django設定 os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings") if __name__ == "__main__": print("🚀 Django ASGI + FastAPI + Gradio 統合アプリ起動中...") print("📡 メインURL: http://localhost:8000") print("🔧 Django Admin: http://localhost:8000/admin") print("� Gradio Chat: http://localhost:8000/gradio") print("� API Docs: http://localhost:8000/docs") # CLIコマンドとしてuvicornをサブプロセスで起動(CLI方式と同じ挙動) subprocess.run([ sys.executable, '-m', 'uvicorn', 'mysite.asgi:app', '--host', '0.0.0.0', '--port', '8000', '--log-level', 'info' ])